amplitude and phase spectrum

57 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by