Filter löschen
Filter löschen

amplitude and phase spectrum

28 Ansichten (letzte 30 Tage)
Sachini Perera
Sachini Perera am 13 Apr. 2021
Beantwortet: Star Strider am 13 Apr. 2021
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

Akzeptierte Antwort

Star Strider
Star Strider am 13 Apr. 2021
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')
.

Weitere Antworten (0)

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by