how to perform FFT on this signal and frequency domain

1 回表示 (過去 30 日間)
zayaz aya
zayaz aya 2018 年 3 月 29 日
コメント済み: Birdman 2018 年 3 月 29 日
t = (0:0.001:1); x = 110*sin(2*pi*50*t); y = 10*sin(2*pi*250*t); z=x+y; plot(z)

採用された回答

Birdman
Birdman 2018 年 3 月 29 日
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 件のコメント
zayaz aya
zayaz aya 2018 年 3 月 29 日
im trying to download it
Birdman
Birdman 2018 年 3 月 29 日
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');

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Fourier and Cosine Transforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by