How to plot average (mean) signal of 231 signals and plot the frequency response of that mean signal?
3 次查看(过去 30 天)
显示 更早的评论
Hi all, I would like to plot an average signal of 231 signals in time domain and plot the frequency response graph. Here is my code and I would appreciate if somebody gives me any idea how to solve it.
signal = a; % acceleration
time=vt; % time
% Plot Original signal in Time Domain
subplot(211);
plot(vt,a(:,1:231,1)); % for sensor 1
title('Multiple signal in Time Domain(Healthy-Sensor1)');
xlabel('Time [s]');
ylabel('Acceleration [m/s^2]');
%FFT plot
Fs=32768; %Sampling frequency
N=2048;
y = fft(a(:,1:231,1),N)/length(signal);
Fn = Fs/2;
Fv = linspace(0, 1, fix(length(y)/2)+1)*Fn;
Iv = 1:length(Fv);
subplot(212);
plot(Fv,abs(y(Iv))*2);
title('FFT(Healthy-Sensor1)');
xlabel('Frequency [Hertz]');
ylabel('Magnitude');
0 个评论
回答(1 个)
Image Analyst
2017-7-23
I don't think you can use fft like this:
y = fft(a(:,1:231,1),N)/length(signal);
fft() is for 1-D signals, not 2-D signals or 3-D signals which is what a(:,1:231,1) is. I think you have to call mean() on one direction of the a signal, then fft that one 1-D mean signal. Please attach a and vt in a .mat file if you want more help.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!