MATLAB: Looping with unequal increment

unequal increment

I have x= 5,15,25,30,45,60,65,70,75,90
other parameters (in the body of loop) depends on x values above
I have to run a loop
for i=min(x) : B :max(x)
Body
endfor
What shall be the B? How to go about it?

Best Answer

x = [5,15,25,30,45,60,65,70,75,90];
for i = 1:length(x)
% Get parameter values from x(i) and store them at i-th array positions
end