```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Negative indices in arrays
Date: Sun, 14 Jun 2009 23:17:16 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 21
Message-ID: <h140ds\$35u\$1@fred.mathworks.com>
References: <h11ecd\$mps\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1245021436 3262 172.30.248.35 (14 Jun 2009 23:17:16 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 14 Jun 2009 23:17:16 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:547382

That's a lot of code for people to read through. You need to realize that some people are willing to help here, but it's your job to make it really easy for them. If you post a 100-line-long code and expect people to decode it and solve your issue then you might not get a response. I'm not being mean, but just trying to help.

Again, from what I understand, you're trying to plot a vector that goes from -10 to 10, right? Is it something like this:

x = -10:10;

And then you're trying to plot it? You never need negative indices. For example, imagine a Cartesian coordinate that goes from -10 to 10 for the x-axis in 1-unit steps:

-10 -9 -8 -7 ... -1 0 1 2 ... 7 8 9 10

OK? You don't have to start your indices from the middle. The beginning of the vector will be the most left number. In this case, your vector X will have the following values:

X = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

X(1) = -10
X(11) = 0
X(21) = 10

Does this make sense? If not, please try to explain a bit more. Please give an example of what exactly it is that you're trying to do instead of posting the entire code. It's really hard to understand a long code that I haven't written and it's not formatted and color-coded in the .m form.

Kian
```