Question: A for loop in MATLAB is similar to a DO Loop in FORTRAN. The main difference is that the FORTRAN DO loop must have an

A for loop in MATLAB is similar to a DO Loop in FORTRAN. The main difference is that the FORTRAN DO loop must have an integer index variable; for does not have this restriction. An example of a for loop that is virtually identical to a DO loop is for k =1:5001; t(k)=(k-1)*0.01; y(k)= sin(t(k));endAnother way of implementing the same loop is to increment t from 0 to 50 in intervals of 0.01:k=0 for t =0:0.01:50;k = k +1; y(k)= sin(t);endThe developers of MATLAB highly recommend that you use the vectorized version of the above for loops:t =0:0.01:50;y = sin(t);

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!