periodogram example code

4 views (last 30 days)
john birt
john birt on 21 Jul 2011
I am trying to get to grips with plotting a periodogram of a financial time series using Matlab. My first port of call was the product documentation for the periodogram on the mathworks website, http://www.mathworks.com/help/toolbox/signal/periodogram.html.
So I went and copied there example code into Matlab, below
Fs = 1000;
t = 0:1/Fs:.3;
x = cos(2*pi*t*200)+0.1*randn(size(t));
periodogram(x,[],'onesided',512,Fs)
but this just gives me an error
??? Attempt to execute SCRIPT periodogram as a function:
C:\Users\Currys\Documents\MATLAB\periodogram.m
what did I do wrong? How can I get to see this example code in practice?

Accepted Answer

Sean de Wolski
Sean de Wolski on 21 Jul 2011
You wrote a script called 'periodogram.m' located at C:\Users\Currys\Documents\MATLAB\periodogram.m.
It's trying to call your script. Change your script's name to something else and then run it.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!