Date: May 1, 2014 4:14 PM
Author: Derek Goring
Subject: Re: Vectorization in Matlab
On Friday, May 2, 2014 5:33:15 AM UTC+12, Ahsham Ali wrote:

> How to increment a variable by a infinite set of numbers, in Matlab. I'v a variable which I want to increment till the loop ends by 0.1 every time but through set of range. I'm currently doing this by: K=K*0.1; %K = 2 initially but I want this same by Matlab's trick of ranged values like [0.1:0.1:9] where 9 is the loop condination.

Here's one way using logs:

x=[0.1:0.1:9];

lx=log10(x); % Take logs

slx=cumsum(lx); % cumulative sum the logs => cumulative product

xprod=10.^slx; % Anti-log