[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to express sinc * exp?
From: |
Al Goldstein |
Subject: |
Re: how to express sinc * exp? |
Date: |
Thu, 9 Mar 2000 13:48:15 -0800 (PST) |
I hadn't seen the Matlab Primer lately so I wondered. Didn't see any links
in Mathworks but got it from altavista. The address ftp.math.ufl.edu/pub/matlab
On Thu, 9 Mar 2000, Dirk Laurie wrote:
> eric skryf:
> >
> > Dear octave expert:
> >
> > In matlab toolbox siganl processing:
> > b=0.4*sinc(0.4*(-25:25));
> > [H,w]=freqz(b,1,512,2);
> > plot(w,abs(H));
> >
> > work
> >
> > but if I want to let b be the product of sinc and
> > 2*exp(-i*pi)+exp(-i*3*pi)
> > b=0.4*sinc*(2*exp(-i*pi)+exp(-i*3*pi))(0.4*(-25:25));
> >
> > is not work,
> > I got
> > x undefined near line 24 column 37
> > ..................
> > etc.
> >
> > how to modify it to work?
> >
> Dear Eric:
>
> I and others have seen and sometimes answered quite a few of
> your questions on this list, but sooner or later someone will
> have to say it. And I'm saying it now:
>
> RTFM (Read The Friendly Manual)
>
> Get hold of a Matlab primer on the Internet.
> Several are available by following links from
> http://www.mathworks.com
> Or buy yourself one of the many books for teaching yourself
> Matlab. Most of what they say is applicable to Octave too.
> It will be faster than asking questions on octave-help.
>
> In the present case,
>
> b=0.4*sinc*(2*exp(-i*pi)+exp(-i*3*pi))(0.4*(-25:25));
>
> you have made two mistakes:
>
> (a) sinc is a function which requires one argument.
> You can therefore write "sinc(0.4*(-25:25))"
> or "x=(0.4*(-25:25)); sinc(x)"
> but not just sinc.
>
> (b) ")(" is never legal syntax. There must always
> be an operator.
>
> The way to code what I think you mean, is:
> x=(0.4*(-25:25));
> b=0.4*sinc(x).*(2*exp(-i*pi*x)+exp(-i*3*pi*x))
>
> Note ".*" for multiplying vectors term by term.
>
> Dirk Laurie
>
>
>
> -----------------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
> How to fund new projects: http://www.che.wisc.edu/octave/funding.html
> Subscription information: http://www.che.wisc.edu/octave/archive.html
> -----------------------------------------------------------------------
>
>
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------