Error: The length of the segments cannot be greater than the length of the input signal.
45 views (last 30 days)
Show older comments
Hi, I'm using the time2psd function to run a script. however the command window gives me this error
("Input" is the script I am using, the below are to be read from bottom to top):
Error using signal.internal.spectral.welchparse>segment_info
The length of the segments cannot be greater than the length of the input signal.
Error in signal.internal.spectral.welchparse (line 34)
[L,noverlap,win] = segment_info(M,win1,noverlap1);
Error in welch (line 55)
signal.internal.spectral.welchparse(x,esttype,args{:});
Error in pwelch (line 170)
[welchOut{1:nargout}] = welch(x,funcName,inputArgs{:});
Error in time2psd (line 4)
[PSD,freq]=pwelch(sign,hann(fft_point),0,fft_point,maxfreq*2);
Error in input (line 47)
[freq_r PSD_r]=time2psd(fft_point,Rx,Fcamp/2)
This is the text of the time2psd function:
function [freq PSD]=time2psd(fft_point,sign,maxfreq)
% Analisi in frequenza (PSD) del segnale temporale
[PSD,freq]=pwelch(sign,hann(fft_point),0,fft_point,maxfreq*2);
% [A,B]=spectrum(sign,fft_point,fft_point/4,hanning(fft_point));
% freq=B(:,1)*maxfreq;
% PSD=A(:,1)/maxfreq;
% fft_point/4
this is the "input" script that I have to run (Rx and Fcamp I already know them)
fft_point = 4096;
[freq_r PSD_r]=time2psd(fft_point,Rx,Fcamp/2)
figure(6)
loglog(freq,PSDinp)
hold on
loglog(freq_r,PSD_r)
xlabel('Frequency [Hz]')
ylabel('Amplitude [N^2/Hz]')
legend('PSD target','PSD ricostruita')
0 Comments
Answers (1)
See Also
Categories
Find more on Digital Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!