From: mas on
Greg Heath <heath(a)alumni.brown.edu> wrote in message <005d11d4-69ef-48e9-b6a3-c934db128334(a)j9g2000vbp.googlegroups.com>...
> On May 17, 12:22 am, "mas " <m...(a)egypt.ca> wrote:
> > Greg Heath <he...(a)alumni.brown.edu> wrote in message <9339e918-764a-436f-88cb-785c0af96...(a)j27g2000vbp.googlegroups.com>...
> > > On May 16, 8:44 pm, "mas " <m...(a)egypt.ca> wrote:
> > > > Hi,
> >
> > > > I would like to solve quadratic equations that are in the form
> > > > Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0
> >
> > > > If I use solve command how to pass the parameters of this equation (A, B, C, D, E, F) to the command. So I mean that there is a for loop and these parameters change in each iteration....
> >
> > > Why use solve when you can write the equations for the solution??
> >
> > > Hope this helps.
> >
> > > Greg
> >
> > Thank you for your reply ... Do you mean to try to solve the 2 quadratic equations  analytically so I can get expression of the intersection points.
>
> SORRY! PLEASE IGNORE.
> I misread the question.
>
> gREG

First thanks to Greg and Aasim for your reply... I think that my question was not clear enough to be understanding.

Let's make it simple... I need to solve problem like that
solve('Ax^2 + Bxy + Cy^2 + Dx+Ey+F','ax^2 + bxy + cy^2 + dx+ey+f'')

my question is that the parameters ABCDEFabcdef are changed each time I run the command. so I was wondering how to run the command with AB... and then i change them with their values.

I found command called subs in symbolic toolbox which i think may solve my problem.

Thank you
From: Steven Lord on

"mas " <mas(a)egypt.ca> wrote in message
news:hsskp7$ijc$1(a)fred.mathworks.com...
> Greg Heath <heath(a)alumni.brown.edu> wrote in message
> <005d11d4-69ef-48e9-b6a3-c934db128334(a)j9g2000vbp.googlegroups.com>...
>> On May 17, 12:22 am, "mas " <m...(a)egypt.ca> wrote:
>> > Greg Heath <he...(a)alumni.brown.edu> wrote in message
>> > <9339e918-764a-436f-88cb-785c0af96...(a)j27g2000vbp.googlegroups.com>...
>> > > On May 16, 8:44 pm, "mas " <m...(a)egypt.ca> wrote:

*snip*

> Let's make it simple... I need to solve problem like that solve('Ax^2 +
> Bxy + Cy^2 + Dx+Ey+F','ax^2 + bxy + cy^2 + dx+ey+f'')
>
> my question is that the parameters ABCDEFabcdef are changed each time I
> run the command. so I was wondering how to run the command with AB... and
> then i change them with their values.

In that case, don't make it a string (but you will need to remember to
include the multiplication.)


A = 1; B = 2; C = 3; D = 4; E = 5; F = 6;
a = 7; b = 8; c = 9; d = 10; e = 11; f = 12;
syms x y
eq1 = A*x^2 + B*x*y + C*y^2 + D*x+E*y+F;
eq2 = a*x^2 + b*x*y + c*y^2 + d*x+e*y+f;
S = solve(eq1,eq2)
residual1 = subs(eq1, {x, y}, {S.x, S.y})
residual2 = subs(eq2, {x, y}, {S.x, S.y})


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