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

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]

답변 (1개)

Jonas
Jonas 2021년 7월 8일

0 개 추천

use l(1)=x instead of l(1)=0;

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2021년 7월 8일

답변:

2021년 7월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by