Subscript indices must either be real positive integers or logicals.
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Yes, I went through the board to see if any of the peoples relate to my question. However, I cannot figure out from them how my problem it's self should appear.
This is my code:
Vla = [];
t = 0:.1:10;
Vs = zeros(length(t),length(t));
for m = 0:length(t)
for n = 0:length(t)
Vs(m,n) = (3.*exp(-t./3)).*sin(pi.*t);
if Vs > 0
Vla = Vs;
else
if Vs <= 0
Vla = 0;
end
end
end
end
plot(t,Vla),xlabel('Time (t)'),ylabel('Voltage (Vla)')
The problem has to do with the Vs, I am sure, but I cannot figure out how to adjust it for it to work properly. I am wondering if my code it's self is all kinds of wrong, or it is just the Vs.
Again I keep getting this code:
"Subscript indices must either be real positive integers or logicals."
Nothing else that goes along with it. No question marks, and not line indices.
Answers (1)
Azzi Abdelmalek
on 26 Feb 2013
Edited: Azzi Abdelmalek
on 26 Feb 2013
Vs(0) is not valid in matlab
Use instead
Vs(n+1,m+1)
1 Comment
Juliet
on 26 Feb 2013
This question is closed.
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!