Record the mean and stddev before you do the transformation, so that you can reapply in the opposite direction:
mu = nanmean(y);
sd = nanstd(y);
y2 = (y - mu) / sd;
...
y3 = y2 * sd + mu;
質問
I have a rather simple question that I need some advice on. If I have a time series
t = 1:365;
raw = 10+(10-2).*rand(1,length(t)); % generate random time series
signal_1 = 10*sin(2*pi*t/12)+20; % create a signal with a period of 24
signal_2 = 10*sin(2*pi*t/32)+20; % create a signal with a period of 32
y = raw + signal_1 + signal_2; % combine the signals
and I can make the signal to have zero mean and unit variance by
y2 = (y - nanmean(y))./nanstd(y); % zero mean with unit variance
How would I convert this back to the same magnitude as the original series i.e. convert back to be the same as 'y'?
解決
Record the mean and stddev before you do the transformation, so that you can reapply in the opposite direction:
mu = nanmean(y);
sd = nanstd(y);
y2 = (y - mu) / sd;
...
y3 = y2 * sd + mu;