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:
recursion expression in matlab

Subject: recursion expression in matlab

From: nuclph nuclph

Date: 6 May, 2010 14:22:05

Message: 1 of 4

hi all,

say, i have the following recursion:

E(s) = d^2/(3d-2) + (3d-3)/(3d-2) E(s-1)
E(0) = 0

If I want to find E(10) i need to expend recursion which will be a sum or series.

Can you suggest is it possible to implement such thing in matlab?

Thank you.

Subject: recursion expression in matlab

From: Steven Lord

Date: 6 May, 2010 14:46:52

Message: 2 of 4


"nuclph nuclph" <bskorodo@gmail.com> wrote in message
news:hrujac$fmm$1@fred.mathworks.com...
> hi all,
>
> say, i have the following recursion:
> E(s) = d^2/(3d-2) + (3d-3)/(3d-2) E(s-1)
> E(0) = 0
>
> If I want to find E(10) i need to expend recursion which will be a sum or
> series.
>
> Can you suggest is it possible to implement such thing in matlab?

Assuming d is a constant not the differential operator, use the FILTER
function or a FOR loop -- but remember that MATLAB uses _1_ based indexing,
not _0_ based, so your E(0) should actually be E(1).

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: recursion expression in matlab

From: nuclph nuclph

Date: 12 May, 2010 01:40:21

Message: 3 of 4

thank you very much for an suggestions.

"Steven Lord" <slord@mathworks.com> wrote in message <hrukon$o55$1@fred.mathworks.com>...
>
> "nuclph nuclph" <bskorodo@gmail.com> wrote in message
> news:hrujac$fmm$1@fred.mathworks.com...
> > hi all,
> >
> > say, i have the following recursion:
> > E(s) = d^2/(3d-2) + (3d-3)/(3d-2) E(s-1)
> > E(0) = 0
> >
> > If I want to find E(10) i need to expend recursion which will be a sum or
> > series.
> >
> > Can you suggest is it possible to implement such thing in matlab?
>
> Assuming d is a constant not the differential operator, use the FILTER
> function or a FOR loop -- but remember that MATLAB uses _1_ based indexing,
> not _0_ based, so your E(0) should actually be E(1).
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>

Subject: recursion expression in matlab

From: Roger Stafford

Date: 12 May, 2010 03:07:04

Message: 4 of 4

"nuclph nuclph" <bskorodo@gmail.com> wrote in message <hrujac$fmm$1@fred.mathworks.com>...
> hi all,
>
> say, i have the following recursion:
>
> E(s) = d^2/(3d-2) + (3d-3)/(3d-2) E(s-1)
> E(0) = 0
>
> If I want to find E(10) i need to expend recursion which will be a sum or series.
>
> Can you suggest is it possible to implement such thing in matlab?
>
> Thank you.
- - - - - - - -
  If you substitute a = d^2/(3*d-2) and b = (3*d-3)/(3*d-2), your iteration becomes

 E(s) = a + b*E(s-1)

and since b is not equal to 1, this can be expressed as

 E(s)-a/(1-b) = b*(E(s-1)-a/(1-b)) .

Since E(0) = 0 you can write

 E(s)-a/(1-b) = b^s*(E(0)-a/(1-b)) = -a/(1-b))*b^s

or

 E(s) = a/(1-b)*(1-b^s) = d^2*(1-(1-1/(3*d-2))^s)

  No need for an iteration or series.

Roger Stafford

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