help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shade region between curves


From: James Sherman Jr.
Subject: Re: Shade region between curves
Date: Tue, 19 May 2009 18:26:24 -0400

"end" is the same as "length(x)" in this scenario.

and the syntax a:b:c results in a vector that starts at a and increments by b till greater (or less than, if b is less than zero) than c.
So for example,
1:1:5 = [1 2 3 4 5]
1:2:5 = [1 3 5]
5:-1:1 = [5 4 3 2 1]

So, for example, if x is a vector of length 5,
x(end:-1:1) = x(5:-1:1) = x([5 4 3 2 1])

Or, long story short, it reverses the order of the elements of x.

On Tue, May 19, 2009 at 5:56 PM, Xin Dong <xdong.cn@gmail.com> wrote:
Hi Rob,

Can you explain x(end:-1:1)? What does that mean?

Thanks,
Xin


On Tue, May 19, 2009 at 12:25 PM, Rob Mahurin <address@hidden> wrote:
On Tue, May 19, 2009 at 3:48 PM, ofeyrpf <address@hidden> wrote:
> Is it possible with Octave to shade a region between two graphs?

On May 19, 2009, at 11:17 AM, Michael Goffioul wrote:
> What you're probably looking for is called "area".


"area" shades between a curve and the x-axis.  You can shade between
two curves with "patch":

octave:13> x = linspace(0,1.5);
octave:14> patch( [x, x(end:-1:1)], [x.^2, x(end:-1:1).^4] , [1 0 0])

There may be an easier way that other people know about.

Rob

--
Rob Mahurin
Department of Physics and Astronomy
University of Tennessee                 865 207 2594
Knoxville, TN 37996                     address@hidden



_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave


_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave



reply via email to

[Prev in Thread] Current Thread [Next in Thread]