[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: an array with negative index
From: |
Hall, Benjamin |
Subject: |
RE: an array with negative index |
Date: |
Mon, 23 Aug 2004 10:37:11 -0400 |
I'm not sure I understand. Is the following not what you are trying to do?
coeff = -4:4;
hits = [0 5 9 12 17 18 13 5 1];
bar( coeff, hits );
# or
plot( coeff, hits, 'o-' );
# or maybe the following is more relevant
ii = find( hits == 18 );
plot( coeff(ii), hits(ii), 'o' )
-----Original Message-----
From: Jean-Michel besnard [mailto:address@hidden
Sent: Monday, August 23, 2004 10:05 AM
To: address@hidden
Subject: an array with negative index
Hi,
I wish to plot a distribution that could look like:
coefficient value: -4 -3 -2 -1 0 1 2 3 4
number of hits: 0 5 9 12 17 18 13 5 1
since an array starts at 1, I can't possibly store the "number of hits" with
an
index corresponding to their "coefficient value".
If I switch the coefficient values by a value starting at 1 (i,e. instead of
-4,...4, it would be 1...9) then when I plot the array I don't see the
relevant
coefficients (in the abscissa ordinate) because of the switch.
Is there a way to get around this problem ?
Thanks,
Jean-Michel
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------