Taking a descend interval

1 vue (au cours des 30 derniers jours)
Jane Smith
Jane Smith le 5 Mar 2021
Commenté : Jane Smith le 5 Mar 2021
for t=1:n
[L(t)]=(1/(50)^(t))
[C(t)]=(1/(800))^(t);
end
For the 1st line (L(t)) i need to use the interval 1:n however for the 2nd line i need from n:1. How do i change t without changing the interval in the for loop?

Réponse acceptée

Alan Stevens
Alan Stevens le 5 Mar 2021
Insert
tau = n+1-t;
then raise 1/800 to the power tau.
  1 commentaire
Jane Smith
Jane Smith le 5 Mar 2021
Worked perfectly! Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by