Taking a descend interval

5 visualizaciones (últimos 30 días)
Jane Smith
Jane Smith el 5 de Mzo. de 2021
Comentada: Jane Smith el 5 de Mzo. de 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?

Respuesta aceptada

Alan Stevens
Alan Stevens el 5 de Mzo. de 2021
Insert
tau = n+1-t;
then raise 1/800 to the power tau.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by