Many operations in Matlab can be done by using logical index

Many operations in Matlab can be done by using logical indexing instead of iteration. Given a vector T, write a loop in Matlab that is equivalent to the following command? T(T > 10) = 10;

Solution

Ans)

The equivalent code for T(T>10)=10 using loop in matlab is

-----------------------------

for i=1:length(T)

if T(i)>10

T(i)=10;

end

end

-----------------------------------------

 Many operations in Matlab can be done by using logical indexing instead of iteration. Given a vector T, write a loop in Matlab that is equivalent to the follow

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site