Help with MATLAB Error: "Subscript Indices Must Be Real Positive Integers

  • Context: MATLAB 
  • Thread starter Thread starter Arkane1337
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
Arkane1337
Messages
7
Reaction score
0
http://i.snag.gy/FBeLq.jpg

I've figured out the first part, (a), it's the second part (b) that's confusing- I've tried re-arranging the plot() function and also tinkering with y1 and y2 rather than y(t), as I get the error:

"Subscript indices must either be real positive integers or logicals."

Any help or advice?
 
Physics news on Phys.org
y(t) is functional notation in mathematics. In MATLAB, y(t) means the t-th element in y. In this case t is even a vector of (noninteger) values, so you end up telling MATLAB you want to look at y(0.05), which doesn't make sense since y doesn't have a 0.05th element, only a 1st, 2nd, etc... So just define y = instead of y(t) = .

I'll get you started..
y = exp(-t./2).*exp(-2*t);
x = ...
plot(t,x)