Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Negative indices in arrays
Date: Sun, 14 Jun 2009 21:16:34 -0400
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <h147cj$6iv$1@fred.mathworks.com>
References: <h11ecd$mps$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1245028563 6751 144.212.105.187 (15 Jun 2009 01:16:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 15 Jun 2009 01:16:03 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
Xref: news.mathworks.com comp.soft-sys.matlab:547396



"Chris G" <n4cag@yahoo.com> wrote in message 
news:h11ecd$mps$1@fred.mathworks.com...
> Since matlab will not allow negative numbers or 0 of indices in arrays, 
> how can I manipulate it to produce numbers for those negative indexes? 
> I'm needing to calculate and plot on a stem plot an array going from -10 
> to 10 for a specified equation.

Do you mean you want a plot like this?

x = -10:1:10;
y = x.^2;
stem(x, y)

Many plotting functions allow you to specify not only y but also x (and for 
3D plotting functions, you can specify all of x, y, and z.)

-- 
Steve Lord
slord@mathworks.com