[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: suite
From: |
Alois Schloegl |
Subject: |
Re: suite |
Date: |
Sun, 12 Dec 2004 16:27:01 +0100 |
User-agent: |
Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux)) |
On Sat, 11 Dec 2004 12:11:38 -0600, Mike Miller wrote:
> On Sat, 11 Dec 2004, adel.essafi wrote:
>
>> hi list
>> please, how can I define a suite in octave
>> U(n+1)=3*U(n)+2 (for example)
>> and calculate u(1000)
>
> A simple method:
>
> n=1000;
> U=zeros(1,n);
> U0=4; #or whatever you want
> U(1)=3*U0+2;
> for i=2:n,
> U(i)=3*U(i-1)+2;
> end
>
Or you can use FILTER if you want to avoid the FOR-loop
z3=filter(1,[1,-3],[U0,zeros(1,n)+2]);
Alois
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- suite, adel\.essafi, 2004/12/11
- Re: suite, Mike Miller, 2004/12/11
- Re: suite,
Alois Schloegl <=