How to convert this ...for loop to while loop ?

2 views (last 30 days)
for i=1:5
for j=1:20
amp=i*1.2;
wt=j*0.05;
v(i,j)=amp*sin(wt);
end
end

Accepted Answer

David Fletcher
David Fletcher on 10 Apr 2021
i=1;
while i<=5
j=1;
while j<=20
amp=i*1.2;
wt=j*0.05;
v(i,j)=amp*sin(wt);
j=j+1;
end
i=i+1;
end

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!