[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Plot Problems
From: |
Thomas Weber |
Subject: |
Re: Plot Problems |
Date: |
Sat, 30 Aug 2008 11:05:42 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hi,
On Fri, Aug 29, 2008 at 10:23:41PM -0300, Marize Simoes wrote:
> I need to save in eps..
> I'm use octave 3.0.0
> My program is.....
> Why don't save eps????
Sorry for the "^M", my mailer seems to not like somthing about your
mail. Anyway, Ben, has already told you about the changed syntax in
Octave 3.0.
This mail is more about your code :)
> t=linspace(-2*pi,2*pi,1024);
> invpsi=zeros(1,length(t));
>
>
> %calculo de Bm(w)
> for w=1:length(t)
> for k=1:15
> Bm=(sin(t(w)/4)/(t(w)/4))^ordem;
> invpsi(w)=invpsi(w)+gama(k)*exp(-i*k*t(w))*Bm;
> end
> end
The "Bm=" part needs not to be in the second loop. In fact there's no
need for it being in any loop. something along
Bm = (sin(t/4) ./ (t/4)) .^ ordem
should give you the full vector Bm. Still, there's room for improvement:
the (sin(x)/x) function is commonly known as the sinc function (with
some scaling paramter, pi or so). So, have a look at Octave's sinc()
function.
> %Deslocamento da SaÃda
> for i=1:length(psi)/2
> coef1(i)=psi(i);
> end
coef1 is just the first half of psi, so write it like that:
coef1 = psi(1:length/2);
> for i=(length(psi)/2)+1:length(psi)
> coef2(i-(length(psi)/2))=psi(i);
> end
coef2 is just the second part of psi, is that correct? Have a look at
the "end" keyword for indices.
Thomas