One day it Worked, the other Day it doesn´t... Error in Spectrogram

3 views (last 30 days)
Specification of FFT parameters
T=10; %Sampling period
Fs=1/T; %Sampling frequency
N=length(i0);
NxtPow2=2^nextpow2(N);
Pow=log2(NxtPow2);
N=2^(Pow-1);
f_PSD=Fs/2*linspace(0,1,N);
nfft=length(f_PSD);
% FFT of current and potential
p0=abs(p0);
fft_p=fft(p0,N);
PSD_p=abs(fft_p);
PSD_p=2*PSD_p/N;
PSD_p(1,1)=PSD_p(1,1)/2;
i0=abs(i0);
fft_i=fft(i0,N);
PSD_i=abs(fft_i);
PSD_i=2*PSD_i/N;
PSD_i(1,1)=PSD_i(1,1)/2;
% Plot of Power Spectral Density of current and potential.
figure(2)
subplot(2,2,1)
grid on
plot(f_PSD,10*log10(PSD_p))
title('Raw Potential PSD')
set(gca,'TickDir','out')
xlabel('Frequency [Hz]')
ylabel('PSD [V²/Hz]')
hold on
subplot(2,2,2)
plot(f_PSD,10*log10(PSD_i))
grid on
title('Raw Current PSD')
set(gca,'TickDir','out')
xlabel('Frequency [Hz]')
ylabel('PSD [A²/Hz]')
hold on
subplot(2,2,3)
spectrogram(p0,hann(30),15,nfft,Fs,'yaxis')
title('Raw Potential Noise Spectrogram')
set(gca,'YScale','log')
set(gca,'TickDir','out')
hold on
subplot(2,2,4)
spectrogram(i0,hann(30),15,nfft,Fs,'yaxis')
title('Raw Current Noise Spectrogram')
set(gca,'YScale','log')
set(gca,'TickDir','out')
hold on
Errors:
Error using spectrogram (line 174)
Too many input arguments.
Error in spectrogram (line 194)
spectrogram({x},'spect',inpArgs{:});
Error in spectrogram (line 194)
spectrogram({x},'spect',inpArgs{:});
Error in spectrogram (line 194)
spectrogram({x},'spect',inpArgs{:});
Error in spectrogram (line 194)
spectrogram({x},'spect',inpArgs{:});
Error in spectrogram (line 194)
spectrogram({x},'spect',inpArgs{:});
Error in spectrogram (line 194)
spectrogram({x},'spect',inpArgs{:});
Error in spectrogram (line 194)
spectrogram({x},'spect',inpArgs{:});
Error in spectrogram (line 194)
spectrogram({x},'spect',inpArgs{:});
Error in MatLab09092021 (line 92)
spectrogram(p0,hann(30),15,nfft,Fs,'yaxis')
  6 Comments
Sean Janik Winter
Sean Janik Winter on 16 Sep 2021
My Fs is 1/T so its 1 if T=1 i´ve had a rate of 1 datapoint per second.
I have 147000 datapoints for p0.
Sean Janik Winter
Sean Janik Winter on 16 Sep 2021
Okai i fixed it. I had to many data Points for my Specs so MatLab ran into errors

Sign in to comment.

Answers (0)

Categories

Find more on Time-Frequency 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!