Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

MATLAB: For-Loop Increment

Writer Mia Lopez
$\begingroup$

I'm trying to use a for-loop in matlab where there is an increment of 0.1, 0.01, 0.001, etc., but I don't understand how to that.

I've tried something like this:

for i = 0.1: "step" : 10^-10

% do something

end

I don't know what to put in "step." Can someone explain if there's a way for me to solve this?

$\endgroup$ 1

1 Answer

$\begingroup$
for i = 10.^[1:-1:-5] disp(i); end

works perfectly in displaying

 10 1 0.10000 0.010000 0.0010000 0.00010000 0.000010000
$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy