Problems with time travel. A (t)=Variable(t-2)
Afficher commentaires plus anciens
I want to make one value of a variable in a for loop dependent on the value of another variable 2 timesteps ago.
When I am on t=1, the code will lookup Variable(-1) which is an invalid index number because array index numbers must start at 1.
Is there a way to say?
if variable(x) has an invalid reference number do y?
Can you please give me an example?
1 commentaire
Azzi Abdelmalek
le 2 Nov 2012
Modifié(e) : Azzi Abdelmalek
le 2 Nov 2012
what is the value of y(-1). give an example
Réponses (2)
Azzi Abdelmalek
le 2 Nov 2012
Modifié(e) : Azzi Abdelmalek
le 2 Nov 2012
eg
y=[0 rand(1,20)]
use
y(max(1,n-n0))
Michael
le 2 Nov 2012
0 votes
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!