File Exchange

image thumbnail

Fully Automatic Signal Spectrum Analyser

version 1.0 (2.57 KB) by

The program produces the frequency spectrum of any signal

8 Downloads

Updated

View License

This program operates as a signal spectrum analyzer and a distortion meter at the same time. It can accept any numerical data representing few cycles of a signal. The data do not need to be equally separated. At least ten data points per cycle are needed. Higher number of data points will of course produce better results. The main advantage of the program is its ability to automatically detect the fundamental frequency. Any part of the spectrum within the frequency band f1-f2 can be calculated and plotted. The input to the software are the time and signal voltage arrays t,v, the frequency band limits f1 and f2 and the accuracy parameter delta. The out puts of the program are the signal plot, the spectral analysis plot, the frequencies and relative amplitudes of the ten most prominent frequency contents. The software has been successfully used to analyze data obtained from oscilloscope screen pictures of many signals using another program written by the author called oscilloscope.
The program can be called through entering
[F,A]=spectrum_analysis(t,v,f1,f2,0.001)
N.B
ONE OTHER PROGRAM NEED TO BE PRESENT IN THE WORK DIRECTORY
It is “maxima” this is in the Zip file

Comments and Ratings (7)

Ali

Ali (view profile)

Rami

Rami (view profile)

Thank you for the code. Can you get total power of a signal from this?
Also, this may be too much to ask, but can you find:
(1) the frequency below which 50% of the total power is present and
(2) the frequency below which 95% of the total power is present?
Thank you in advance,
Sarah

Gaoxiang

Thanks!
This code is very good!
Could you list some references of this spectrum analyzer code? I have an interest in the details of this method!

Please disregard my comment above, I see my mistake, the code works fine. Thank you!

Hi, I enter the following...

t=[0:0.0001:40];
v=sin(2*pi.*t)+cos(5*pi.*t)+sin(7*pi.*t)+sin(12*pi.*t)+cos(15*pi.*t)+sin(17*pi.*t)+sin(22*pi.*t)+cos(25*pi.*t)+sin(27*pi.*t)+sin(32*pi.*t);
[f,U]=Spectrum_Analyser(t,v,1,40,0.001);

...and I get frequencies of 1, 2.5, 3.5, 6, 7.5, 8.5, 11, 12.5, 13.5, 16.

But I was expecting 2, 5, 7, 12, 15, 17, 22, 25, 27, 32.

Why is that?

Saud

Saud (view profile)

I am new in MATLAB spectram analtsis. any body tell me how to run this code. when i try to run this code the following error is coming:

??? Input argument "t" is undefined.

Error in ==> Spectrum_Analyser at 28
[x,y]=maxima(t,v);

Walid

Walid (view profile)

thanks a lot, great work !

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video