MATLAB r2010a, i got error for help example !!!!WHY and HOW ??
古いコメントを表示
Hi , when i the used pmtm function for spectrum estimation i got an error here the code which is exactly the help example
fs = 1000;
t = 0:1/fs:0.3;
x = cos(2*pi*t*200) + 0.1*randn(size(t));
[Pxx,Pxxc,f] = pmtm(x,3.5,512,fs,0.99);
hpsd = dspdata.psd([Pxx Pxxc],'Fs',fs);
plot(hpsd)
I got this error
Error in ==> computepsd at 28
if nargin < 7
??? Output argument "varargout{4}" (and maybe others) not assigned during call to
"C:\Program Files\MATLAB\R2010a\toolbox\signal\signal\computepsd.m>computepsd".
Error in ==> pmtm at 118
[Pxx,Sxx,f,units] = computepsd(S,w,params.range,params.nfft,params.Fs);
Can you help me to solve the problem.Thanks
1 件のコメント
Tobias
2013 年 4 月 8 日
You should really make use of the code syntax provided by the forum. Make use of the preview of your message, if you are insecure whether it worked or not.
fs = 1000;
t = 0:1/fs:0.3;
x = cos(2*pi*t*200) + 0.1*randn(size(t));
[Pxx, Pxxc, f] = pmtm(x,3.5,512,fs,0.99);
hpsd = dspdata.psd([Pxx Pxxc], 'Fs', fs);
plot(hpsd)
In the end, it makes it much easier on people's eyes when trying to figure out what went wrong
回答 (3 件)
Andreas Goser
2013 年 4 月 8 日
Your code works on my installation (Relase 2012b, Win7). Just in case you have the product installed, but something goes wrong with the license, can you run the command
license('test', 'signal_toolbox')
It should return "1".
In case this doesn't help, put your code into a script and then step through the code in the editor (debugging) and see what exactly happens in line 118 of pmtm.m.
Image Analyst
2013 年 4 月 8 日
編集済み: Image Analyst
2013 年 4 月 8 日
Worked fine for me. What does this say:
>> which -all pmtm
It should say:
C:\Program Files\MATLAB\R2013a\toolbox\signal\signal\pmtm.m
Try this code:
hasSPT = license('test', 'signal_toolbox')
if ~hasSPT
% User does not have the toolbox installed.
message = sprintf('Sorry, but you do not seem to have the Signal Processing Toolbox licensed or installed properly.');
uiwait(warndlg(message));
end
1 件のコメント
Image Analyst
2013 年 4 月 8 日
編集済み: Image Analyst
2013 年 4 月 8 日
This should have been a comment, not an answer. Glad that my suggestion to use "which" solved it for you. Go ahead and mark my answer above as Accepted.
カテゴリ
ヘルプ センター および File Exchange で Spectral Estimation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!