How to plot the spectrum of a signal which is an array of amplitudes and not a sin or cos wave ?

2 visualizaciones (últimos 30 días)
I have an array,which is my signal. The x axis is not time,just the actual order of the values.Basically sample points.
How can I plot the spectrum of this signal(the amplitude against the frequency) ? I've tried numerous methods with the fft function,but I can't get it right,and I was wondering whether it is even possible,if the timespan is not specified. We only know the sampling frequency.
Signal_Spectrum = fft(Signal);
L = length(Signal);
f = 0:Frequency/2;
P2 = abs(Signal_Spectrum/L);
P1 = 2*P2(1:L/2+1);
plot(f,P1)
I've tried this and I can't get it to work,because the vectors aren't the same length,so I am missing something. Also I want to store the spectrum on a variable,what should actually be named to be Signal_Spectrum ?

Respuestas (0)

Categorías

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

Productos


Versión

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by