neoflash
Advanced Member level 1
errors in matlab demos
There is a Matlab demo in help file on PSD.
fs = 1000; % Sampling frequency
t = (0:fs)/fs; % One second worth of samples
xn = sin(2*pi*50*t);
Hs = spectrum.periodogram('Hamming');
psd(Hs,xn,'Fs',fs,'NFFT',1024,'SpectrumType','twoside')
[Pxxo,F] = psd(Hs,xn,'Fs',fs,'SpectrumType','onesided');
Pow = (fs/(2*length(Pxxo))) * sum(Pxxo)
However, during running, it reported error as:
??? Error using ==> psd
Too many output arguments.
Error in ==> psd_test2 at 7
[Pxxo,F] = psd(Hs,xn,'Fs',fs,'SpectrumType','onesided');
what is wrong with this demo?
thanks.
There is a Matlab demo in help file on PSD.
fs = 1000; % Sampling frequency
t = (0:fs)/fs; % One second worth of samples
xn = sin(2*pi*50*t);
Hs = spectrum.periodogram('Hamming');
psd(Hs,xn,'Fs',fs,'NFFT',1024,'SpectrumType','twoside')
[Pxxo,F] = psd(Hs,xn,'Fs',fs,'SpectrumType','onesided');
Pow = (fs/(2*length(Pxxo))) * sum(Pxxo)
However, during running, it reported error as:
??? Error using ==> psd
Too many output arguments.
Error in ==> psd_test2 at 7
[Pxxo,F] = psd(Hs,xn,'Fs',fs,'SpectrumType','onesided');
what is wrong with this demo?
thanks.