Ezplot constants?

  • Follow


I want to plot some quadratic functions with varying coefficients, for example:

syms x
syms y
ezplot('2*x^2 + 3*y^2 = 1')

but I want to iterate/vary the '2' and '3' in that expression, something like
a = 2
b = 3
ezplot('a*x^2 + b*y^2 = 1')

but of course a and b aren't recognized inside the ' ' .

How should I do this?

Thanks,

Dave
0
Reply daviddoria (337) 10/17/2009 3:47:03 PM

"David Doria" <daviddoria@gmail.com> wrote in message 
news:hbcotn$e16$1@fred.mathworks.com...
>I want to plot some quadratic functions with varying coefficients, for 
>example:
>
> syms x
> syms y
> ezplot('2*x^2 + 3*y^2 = 1')
>
> but I want to iterate/vary the '2' and '3' in that expression, something 
> like
> a = 2
> b = 3
> ezplot('a*x^2 + b*y^2 = 1')
>
> but of course a and b aren't recognized inside the ' ' .
>
> How should I do this?
>
> Thanks,
>
> Dave

a = 10
b = 11
ezplot(subs('a*x^2 + b*y^2 = 1'))

--Nasser 


0
Reply Nasser 10/17/2009 6:47:03 PM


"Nasser M. Abbasi" <nma@12000.org> wrote in message 
news:BioCm.23531$cL1.21749@newsfe20.iad...
>
> "David Doria" <daviddoria@gmail.com> wrote in message 
> news:hbcotn$e16$1@fred.mathworks.com...
>>I want to plot some quadratic functions with varying coefficients, for 
>>example:
>>
>> syms x
>> syms y
>> ezplot('2*x^2 + 3*y^2 = 1')
>>
>> but I want to iterate/vary the '2' and '3' in that expression, something 
>> like
>> a = 2
>> b = 3
>> ezplot('a*x^2 + b*y^2 = 1')
>>
>> but of course a and b aren't recognized inside the ' ' .
>>
>> How should I do this?
>>
>> Thanks,
>>
>> Dave
>
> a = 10
> b = 11
> ezplot(subs('a*x^2 + b*y^2 = 1'))

Another alternative:

a = 10;
b = 11;
ezplot(a*x^2+b*y^2-1)

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ 


0
Reply slord (13267) 10/17/2009 7:09:07 PM

> > a = 10
> > b = 11
> > ezplot(subs('a*x^2 + b*y^2 = 1'))
> 
> Another alternative:
> 
> a = 10;
> b = 11;
> ezplot(a*x^2+b*y^2-1)
> 
> -- 
> Steve Lord

Great - thanks all!
0
Reply daviddoria (337) 10/19/2009 12:54:02 PM

3 Replies
20 Views

(page loaded in 0.085 seconds)

Similiar Articles:




7/29/2012 3:44:33 AM


Reply: