Modify signal and define natural frequency
Ältere Kommentare anzeigen

Hello everyone, I would like to define natural frequencies of the signals that I plotted (PSD and FFT). How is it possible to "modify" the plot in order to get more precise and clear peaks of the signals. It would be appreciated if you give me a piece of advice how to work out it. Thanks in advance!
signal1=a(:,1,1);
signal2=a(:,232,1);
Fs=32768;
subplot(211);
N=2048;
y1= fft(signal1,N)/length(signal1);
Fn = Fs/2;
Fv = linspace(0, 1, fix(length(y1)/2)+1)*Fn;
Iv = 1:length(Fv);
y2= fft(signal2,N)/length(signal2);
Fn = Fs/2;
Fv = linspace(0, 1, fix(length(y2)/2)+1)*Fn;
Iv = 1:length(Fv);
subplot(211)
plot(Fv,abs(y1(Iv))*2,'r');
hold on
plot(Fv,abs(y2(Iv))*2,'g');
title('Frequency Response-FFT')
xlabel('Frequency (Hz)')
ylabel('Magnitude')
%red signal
N1 = length(signal1);
xdft1 = fft(signal1);
xdft1 = xdft1(1:N1/2+1);
psdx1 = (1/(2*pi*N1)) * abs(xdft1).^2;
psdx1(2:end-1) = 2*psdx1(2:end-1);
freq1 = 0:(2*pi)/N1:pi;
%green signal
N2 = length(signal2);
xdft2 = fft(signal2);
xdft2 = xdft2(1:N1/2+1);
psdx2 = (1/(2*pi*N2)) * abs(xdft2).^2;
psdx2(2:end-1) = 2*psdx2(2:end-1);
freq2 = 0:(2*pi)/N2:pi;
subplot(212)
plot(freq1/pi,10*log10(psdx1),'r')
hold on
plot(freq2/pi,10*log10(psdx2),'g')
title('Periodogram Using FFT')
xlabel('Normalized Frequency (\times\pi rad/sample)')
ylabel('Power/Frequency (dB/rad/sample)')
Antworten (0)
Kategorien
Mehr zu Spectral Estimation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!