Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
increase a value each iteration

Subject: increase a value each iteration

From: MEXICO

Date: 3 Jan, 2013 05:26:15

Message: 1 of 2

hi frieds, i guess this is more a math question than programming, but i have this problem, i would like to increase dy a variable y each n iteration values, por example,

i have nmax iteration

nmax=50;

i have diferential values of y

dy=.5

so i do a loop

for i=1:nmax

y(i)= and my question is here. ??
end

so i want an output like

y(1)=0
y(2)=.5
y(3)=1

so on until 50 iteration, so my question is a funcion y(i) that give me a vector of dy increments but in function of i. thanks for advance

Subject: increase a value each iteration

From: Nasser M. Abbasi

Date: 3 Jan, 2013 05:41:14

Message: 2 of 2

On 1/2/2013 11:26 PM, MEXICO wrote:
> hi frieds, i guess this is more a math question than programming, but i have this problem,
>i would like to increase dy a variable y each n iteration values, por example,
>
> i have nmax iteration
>
> nmax=50;
>
> i have diferential values of y
>
> dy=.5
>
> so i do a loop
>
> for i=1:nmax
>
> y(i)= and my question is here. ??
> end
>
> so i want an output like
>
> y(1)=0
> y(2)=.5
> y(3)=1
>
> so on until 50 iteration, so my question is a funcion y(i) that give me a vector of
>dy increments but in function of i. thanks for advance
>

may be

   y=0:0.5:(50*0.5)

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us