How to plot average (mean) signal of 231 signals and plot the frequency response of that mean signal?
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Image Analyst
on 23 Jul 2017
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.
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!