periodogram example code

조회 수: 4 (최근 30일)
john birt
john birt 2011년 7월 21일
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?

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 7월 21일
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.
  댓글 수: 1
john birt
john birt 2011년 7월 21일
cheers, how stupid of me!!!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by