Question: If we want to execute a command for multiple times, we can create a loop in MATLAB to do the job. ( a ) Click

If we want to execute a command for multiple times, we can create a loop in MATLAB to do the job.
(a) Click the "New" (or "New Script") button on the top left of the screen, then enter the following commands. This is an example of a for loop.
n=20
x=zeros(1,n)
sum =0
for i=1:n
,x(i)=i???2
sum =??+x(i)
end
sum
2
 If we want to execute a command for multiple times, we

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!