Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem in plotting !!

Subject: problem in plotting !!

From: Animesh Pandey

Date: 16 Jul, 2012 20:25:05

Message: 1 of 6

How do I plot a graph like ...

1 <= x^2 + y^2 + 10*x +25 <= 121 .... ?

Please help!
Thanks!

Subject: problem in plotting !!

From: steve.nospamm@gmail.com

Date: 16 Jul, 2012 20:32:52

Message: 2 of 6

On Monday, July 16, 2012 3:25:05 PM UTC-5, Animesh Pandey wrote:
> How do I plot a graph like ...
>
> 1 <= x^2 + y^2 + 10*x +25 <= 121 .... ?
>
> Please help!
> Thanks!

explain in englisho what it mean? what like function do that

Subject: problem in plotting !!

From: TideMan

Date: 16 Jul, 2012 22:01:32

Message: 3 of 6

On Tuesday, July 17, 2012 8:25:05 AM UTC+12, Animesh Pandey wrote:
> How do I plot a graph like ...
>
> 1 <= x^2 + y^2 + 10*x +25 <= 121 .... ?
>
> Please help!
> Thanks!

What sort of graph?
contour? help contour
surface? help surf

Subject: problem in plotting !!

From: Animesh Pandey

Date: 17 Jul, 2012 04:37:48

Message: 4 of 6

TideMan <mulgor@gmail.com> wrote in message <0eb0ae52-7cb6-4fcb-a673-b0963ad971fd@googlegroups.com>...
> On Tuesday, July 17, 2012 8:25:05 AM UTC+12, Animesh Pandey wrote:
> > How do I plot a graph like ...
> >
> > 1 <= x^2 + y^2 + 10*x +25 <= 121 .... ?
> >
> > Please help!
> > Thanks!
>
> What sort of graph?
> contour? help contour
> surface? help surf

In english it is ...
plot those values of x, y where the value of the expression, x^2 + y^2 + 10*x +25, is between and 1 and 121 ....

A normal planar graph or a contour graph is required!

Thanks!

Subject: problem in plotting !!

From: Nasser M. Abbasi

Date: 17 Jul, 2012 05:01:41

Message: 5 of 6

On 7/16/2012 11:37 PM, Animesh Pandey wrote:
> TideMan <mulgor@gmail.com> wrote in message <0eb0ae52-7cb6-4fcb-a673-b0963ad971fd@googlegroups.com>...
>> On Tuesday, July 17, 2012 8:25:05 AM UTC+12, Animesh Pandey wrote:
>>> How do I plot a graph like ...
>>>
>>> 1 <= x^2 + y^2 + 10*x +25 <= 121 .... ?
>>>
>>> Please help!
>>> Thanks!
>>
>> What sort of graph?
>> contour? help contour
>> surface? help surf
>

> In english it is ...
> plot those values of x, y where the value of the expression,
>x^2 + y^2 + 10*x +25, is between and 1 and 121 ....
>

THis will get you started.

In[12]:= expr=x^2+y^2+10*x+25;
Reduce[1<expr<121,{x,y}]

(-16<x<-6&&-Sqrt[96-10 x-x^2]<y<Sqrt[96-10 x-x^2])||

(-6<=x<=-4&&(-Sqrt[96-10 x-x^2]<y<-Sqrt[-24-10 x-x^2]||Sqrt[-24-10 x-x^2]<y<Sqrt[96-10 x-x^2]))||

(-4<x<6&&-Sqrt[96-10 x-x^2]<y<Sqrt[96-10 x-x^2])


So, you have 3 cases to select. the || means OR in case you did not know.

Now you have the relations, you can generate the points that satisfy this
and make the plot.

hth,

--Nasser

Subject: problem in plotting !!

From: Steven_Lord

Date: 17 Jul, 2012 16:44:56

Message: 6 of 6



"Nasser M. Abbasi" <nma@12000.org> wrote in message
news:ju2rjl$kno$1@speranza.aioe.org...
> On 7/16/2012 11:37 PM, Animesh Pandey wrote:
>> TideMan <mulgor@gmail.com> wrote in message
>> <0eb0ae52-7cb6-4fcb-a673-b0963ad971fd@googlegroups.com>...
>>> On Tuesday, July 17, 2012 8:25:05 AM UTC+12, Animesh Pandey wrote:
>>>> How do I plot a graph like ...
>>>>
>>>> 1 <= x^2 + y^2 + 10*x +25 <= 121 .... ?
>>>>
>>>> Please help!
>>>> Thanks!
>>>
>>> What sort of graph?
>>> contour? help contour
>>> surface? help surf
>>
>
>> In english it is ...
>> plot those values of x, y where the value of the expression,
>>x^2 + y^2 + 10*x +25, is between and 1 and 121 ....
>>
>
> THis will get you started.
>
> In[12]:= expr=x^2+y^2+10*x+25;
> Reduce[1<expr<121,{x,y}]

Nasser,

Not a big deal, but I think you forgot to which newsgroup you were currently
posting, as that looks like Mathematica code not MATLAB code.

Animesh,

A quick and dirty way to do this:

[x, y] = meshgrid(-20:0.1:7, -15:0.1:15);
z = x.^2 + y.^2 + 10*x + 25;
% Z's outside the limits you specified are replaced by NaN
z(z < 1) = NaN;
z(z > 121) = NaN;
% NaN values don't show up in a surface plot
surf(x, y, z)
shading interp % to avoid the grid lines concealing all the colored faces

I chose the limits via trial and error to include the region of interest for
your function.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

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.

Contact us