Reputation: 11
I am given 321 samples of signal y(t) with sampling frequency of 80Hz on the time interval 0 to 4s. I am trying to reconstruct y(t) and plot it in matlab but am getting this error. Here is my work
T=1/80;
n=1:321;
t=n*T;
y(t)=signal(n);
Subscript indices must either be real positive integers or logicals.
I am not sure what I am doing wrong here. My data is stored in 'signal' file so signal(n) retrieves the value of signal at index n. I want to find y(t) and plot y(t) versus t. Can somebody help me with this . Thank you.
Upvotes: 0
Views: 122
Reputation: 441
All indices into vectors must be positive integers. The vector t
does not contain integers due to the multiplication by T
. Try:
y=signal(n);
Upvotes: 1