How can I fix the error "Index exceeds matrix dimension
Show older comments
Hell, Im NEW to Matlab and I'm trying to plot the the stem function for the decimate sequence. I got the error msg saying "Index exceeds matrix dimension". Here is my code: The question is to use the the function decimate, using factor of 4 decimal and use the stem function to plot the original signal and the decimate. Use both default IRR and FIR decimate filter.
n1=0:100;
x1=cos(.15*pi.*n1);
d=decimate(x1,4);
subplot(2,1,1);
y1-stem(0:100,x(1:101), 'filled','markersize',3);
title('original signal');
subplot(2,1,2);
y11=stem(0:100,d(1:100), 'filled','markersize',3); % ERROR MSG SHOWS HERE.
title('decimate signal);
Could someone help to explain how I select the index/range for the "statment y11"? Appreciate much for your time and help. Thank you
1 Comment
jaweria kainat
on 3 May 2018
i didn't get the answer. got error in the following line
imshow(xTrainImages{i});
Accepted Answer
More Answers (2)
Roger Stafford
on 10 Feb 2017
0 votes
The reason for the error message is undoubtedly the fact that d has only 26 elements, not one hundred, so d(1:100) is invalid.
ALAGONDA MOUNIKA
on 25 Dec 2017
0 votes
Categories
Find more on Multirate Signal Processing 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!