フィルターのクリア

How to solve 'Index exceeds the number of array elements (1)'

1 回表示 (過去 30 日間)
Lima Parhiz
Lima Parhiz 2019 年 10 月 21 日
コメント済み: KALYAN ACHARJYA 2019 年 10 月 25 日
Hello
I have to compute the power spectrum of EEG and LFP signals for an assignment. I have written a function for computing the autospectrum and I have to use the imagesc function in order to generate the power spectra. Due to requirements for my assignment, I cannot use the function spectrogram.
Computing the autospectrum values works fine however when I have to plot the spectra, I get the error "Index exceeds the number of array elements (1)". I am writing this for my code for plotting the spectrograms:
% Plotting spectrogram
b = F < 200; % Boolean variable indicating frequency range
figure
imagesc((t(1:min(N_col))/60),F(b),conv2(10*log10(P_norm(b,:)),ones(5,2)/10,'same'))
caxis([-3 3])
set(gca,'YDir','default')
colormap jet
xlabel('Time (min)')
ylabel('Frequency (Hz)')
h=colorbar;
ylabel(h,'Power relative to baseline (dB)')
title([TT.BRAINREGION{j} ', Dose:' num2str(TT.DOSE(j)) 'mg/kg'])
pause
Is there some sort of error in the Imagesc line? I am unsure how to solve the issue.
  3 件のコメント
Kaashyap Pappu
Kaashyap Pappu 2019 年 10 月 25 日
There is a chance the value of "b" is too high for indexing into an array. However it is hard to say what exactly is causing the error, as the cyclist has already mentioned.
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 10 月 25 日
Hello Lima,
Please provide the entire code along with data, it can be easily detectable in 1 min, rather than guessing.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeAI for Signals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by