how to perform FFT on this signal and frequency domain

1 vue (au cours des 30 derniers jours)
zayaz aya
zayaz aya le 29 Mar 2018
Commenté : Birdman le 29 Mar 2018
t = (0:0.001:1); x = 110*sin(2*pi*50*t); y = 10*sin(2*pi*250*t); z=x+y; plot(z)

Réponse acceptée

Birdman
Birdman le 29 Mar 2018
Try this:
[pxx1,f1] = pwelch(y1,512,66.7,[],1000);
[pxx2,f2] = pwelch(y2,512,66.7,[],1000);
figure(1);
semilogx(f1,pxx1);xlabel('Frequency(Hz)');title('2*pi*50*t');
figure(2);
semilogx(f2,pxx2);xlabel('Frequency(Hz)');title('2*pi*250*t');
You will see each signal's frequency domain plot, which has peaks at 50 and 250 Hz respectively.
  3 commentaires
zayaz aya
zayaz aya le 29 Mar 2018
im trying to download it
Birdman
Birdman le 29 Mar 2018
Try this:
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1001; % Length of signal
t = (0:L-1)*T; % Time vector
y1=110*sin(2*pi*50*t);
y2=10*sin(2*pi*250*t);
f = Fs*(0:(L/2))/L;
Y1=abs(fft(y1));
Y2=abs(fft(y2))
figure(1);
semilogx(f,Y1(1:numel(f)));xlabel('Frequency(Hz)');title('2*pi*50*t');
figure(2);
semilogx(f,Y2(1:numel(f)));xlabel('Frequency(Hz)');title('2*pi*250*t');

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by