Borrar filtros
Borrar filtros

amplitude and phase spectrum

28 visualizaciones (últimos 30 días)
Sachini Perera
Sachini Perera el 13 de Abr. de 2021
Respondida: Star Strider el 13 de Abr. de 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

Respuesta aceptada

Star Strider
Star Strider el 13 de Abr. de 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')
.

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by