How can i get variable from loop and then use it.

1 Ansicht (letzte 30 Tage)
muhammad kaleem
muhammad kaleem am 8 Jul. 2021
Beantwortet: Jonas am 8 Jul. 2021
clear
syms x
l(1)=0;
for i=2:10
l(i)=l(i-1)+x;
end
i want the answer of this is [x,2x,3x,4x,5x...10x]

Antworten (1)

Jonas
Jonas am 8 Jul. 2021
use l(1)=x instead of l(1)=0;

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by