MATLAB Answers


how can i smooth this plot?

Asked by Jose Sandoval on 9 Oct 2017
Latest activity Commented on by Kh zaa
on 16 Sep 2018
Regards, I have this curve that I show in the screen capture, but its tendency is very scattered I would like to know if there is the possibility of approaching it to a graph of the linear type by means of a filter
thank you very much
attached the data


Sign in to comment.

1 Answer

Answer by Star Strider
on 9 Oct 2017
 Accepted Answer

You have broadband noise. There may be a signal at about 0.35 Hz.
The Fourier transform analysis:
D = xlsread('power.xls');
t = D(:,1);
p = D(:,2);
L = length(t);
Ts = mean(diff(t)); % Sampling Interval (sec)
Fs = 1/Ts; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
FT_p = fft(p - mean(p))/L; % Fourier Transform (Discrete)
Fv = linspace(0, 1, fix(length(t)/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
plot(Fv, abs(FT_p(Iv))*2)
I will leave it for you to sort this.

  1 Comment

I use level-1 s-function in my simulink model. Measurements of 5 variables are collected in simulink and sent to s-function. In order to filter out some of measurements noise, i need to use the average of the snapshots received over a a time window (i.e. 2 second). how i can do that ? thanks

Sign in to comment.