how to perform FFT on this signal and frequency domain

1 Ansicht (letzte 30 Tage)
zayaz aya
zayaz aya am 29 Mär. 2018
Kommentiert: Birdman am 29 Mär. 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)

Akzeptierte Antwort

Birdman
Birdman am 29 Mär. 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 Kommentare
zayaz aya
zayaz aya am 29 Mär. 2018
im trying to download it
Birdman
Birdman am 29 Mär. 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');

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by