amplitude and phase spectrum

57 ビュー (過去 30 日間)
Sachini Perera
Sachini Perera 2021 年 4 月 13 日
回答済み: Star Strider 2021 年 4 月 13 日
i have this signal.
x=8*cos(30*pi*t+pi/3)+6*sin(50*pi*t-pi/3)+8*cos(70*pi*t-pi/4)
i want to make
  1. single-sided amplitude spectrum
  2. single-sided phase spectrum
  3. double-sided amplitude spectrum
  4. double-sidedphase spectrum
i want the final graphs to look like this. how do i do this ? This above image is just an example not the correct values. Im confused because all the answers suggest fft

採用された回答

Star Strider
Star Strider 2021 年 4 月 13 日
No idea what the sampling frequency is, so I created one.
Try this:
Fs = 600;
t = linspace(0, Fs*10, Fs*10)/Fs;
x=8*cos(30*pi*t+pi/3)+6*sin(50*pi*t-pi/3)+8*cos(70*pi*t-pi/4);
L = numel(t);
Fc = fft(x)/L;
Ts = mean(diff(t));
Fn = Fs/2;
Fv2 = linspace(-Fn, Fn, numel(t));
figure
subplot(2,1,1)
plot(Fv2, fftshift(abs(Fc)))
title('Amplitude')
grid
subplot(2,1,2)
plot(Fv2, angle(fftshift(Fc)))
title('Phase')
grid
sgtitle('Double-Sided Fourier Transform')
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
subplot(2,1,1)
plot(Fv, abs(Fc(Iv))*2)
title('Amplitude')
grid
subplot(2,1,2)
plot(Fv, angle(Fc(Iv)))
title('Phase')
grid
sgtitle('Single-Sided Fourier Transform')
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by