Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!f17g2000prh.googlegroups.com!not-for-mail
From: matlab_learner <cibeji@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to do negative array in Matlab
Date: Sat, 20 Feb 2010 19:38:36 -0800 (PST)
Organization: http://groups.google.com
Lines: 37
Message-ID: <7a085831-160e-411e-953e-316d9c269221@f17g2000prh.googlegroups.com>
References: <995678e2-4a26-4684-9284-92c897959b78@c34g2000pri.googlegroups.com> 
	<hlq3gd$i1u$1@fred.mathworks.com>
NNTP-Posting-Host: 24.56.58.253
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1266723517 19931 127.0.0.1 (21 Feb 2010 03:38:37 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 21 Feb 2010 03:38:37 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: f17g2000prh.googlegroups.com; posting-host=24.56.58.253; 
	posting-account=nUO32woAAAC5CU8-JMBgGU0XHaAgs4vn
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) 
	Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:610103

On Feb 20, 6:50 pm, "ade77 " <ade1...@gmail.com> wrote:
> matlab_learner <cib...@gmail.com> wrote in message <995678e2-4a26-4684-9284-92c897959...@c34g2000pri.googlegroups.com>...
> > Hello.
>
> > Just using Matlab for the first time.
> > I have an array that runs from -1 to 1, and I want to divide this into
> > 20 equal parts.
>
> > How can I achieve this.
>
> > >> whos
> >   Name      Size            Bytes  Class     Attributes
>
> >   L         1x3                24  double
> >   M         1x1                 8  double
> >   dx        1x3                24  double
> >   i         1x1                 8  double
> >   x         0x0                 0  double
>
> > L=-1:1;  % bounds
> > M=20;
> > dx = L/M;
>
> > for i=1:(M+1);
> >     x(i) = (i-1) * dx
> > end
>
> > Thank you.
>
> for your specific example, see help linspace
> linspace(-1,1,20)

But then I need to know the value of the space between each point.

How can i pull that out of linspace?