Thread Subject: Shading between two lines

Subject: Shading between two lines

From: molofishy

Date: 10 Nov, 2009 10:57:21

Message: 1 of 4

I have the following variables:

X = log10(1./(360*(1. - [0:1:(360*10-1)]/(360*10-1))));

Y= 1:1:size(x, 2)

Y1=Y-1

>> whos
  Name Size Bytes Class Attributes

  X 1x3600 28800 double
  Y 1x3600 28800 double
  Y1 1x3600 28800 double

Shading between these two plots doesn't seem to work:

A=[X fliplr(X)]

B=[Y fliplr(Y1)]

fill[A, B, 'r']

Yet the lines turn black, as opposed to the usual blue...so something is happening. I wanted the area between the lines to be shaded. I am relatively new to matlab. Thanks!

Subject: Shading between two lines

From: molofishy

Date: 11 Nov, 2009 10:42:11

Message: 2 of 4

Is this even possible?

Subject: Shading between two lines

From: Godzilla

Date: 12 Nov, 2009 04:44:04

Message: 3 of 4

molofishy <angoli001@uct.ac.za> wrote in message <194007991.50477.1257936161590.JavaMail.root@gallium.mathforum.org>...
> Is this even possible?

Check out:

shadeplot

in the file exchange.

Subject: Shading between two lines

From: Jan Simon

Date: 12 Nov, 2009 09:10:19

Message: 4 of 4

Dear molofishy!

> X = log10(1./(360*(1. - [0:1:(360*10-1)]/(360*10-1))));
> Y= 1:1:size(x, 2)
> Y1=Y-1

> Shading between these two plots doesn't seem to work:
> A=[X fliplr(X)]
> B=[Y fliplr(Y1)]
> fill[A, B, 'r']
>
> Yet the lines turn black, as opposed to the usual blue...so something is happening. I wanted the area between the lines to be shaded. I am relatively new to matlab. Thanks!

First of all I stuck at:
  X = log10(1./(360*(1. - [0:1:(360*10-1)]/(360*10-1))))
Simpler:
  X = log10(1 ./ (360:-360/3599:0))
This causes a division by zero. Never mind?!

Then "fill[A, B, 'r']" is not valid, I assume you want:
  fill(A, B, 'r')
To my surprise FILL does not close this area, although the help text state this. Nevertheless, closing the shape manually works:
  X = log10(1 ./ (360:-360/3599:0))
  x(end) = 1; // Filll Inf value from div by 0
  A = [X, fliplr(X), X(1)];
  B = [Y, fliplr(Y1), Y(1)];
  fill(A, B, 'r')
Now you get a red area surrounded by a black line, as I'd expect.

Finally: What do you expect? What do you mean by "shading"?

Jan

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com