problem in plotting !!

  • Follow


How do I plot a graph like ...

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

Please help!
Thanks!
0
Reply apanimesh061 (35) 7/16/2012 8:25:05 PM

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

explain in englisho what it mean? what like function do that
0
Reply steve.nospamm (41) 7/16/2012 8:32:52 PM


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

What sort of graph?
contour?   help contour
surface?   help surf
0
Reply mulgor (2847) 7/16/2012 10:01:32 PM

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!
0
Reply apanimesh061 (35) 7/17/2012 4:37:48 AM

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
0
Reply Nasser 7/17/2012 5:01:41 AM


"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 

0
Reply slord (13279) 7/17/2012 4:44:56 PM

5 Replies
38 Views

(page loaded in 0.117 seconds)


Reply: