How to solve quadratic equation in x and y?

Hello everyone,
Could someone help me, please?
I would like to solve this quadratic equation:
f(x,y) = 3x^2 - 6y^2 + 1
and plot it in the 3D space. For the surface in the space I would like to have the x, y couples of data.
Thank you very much
Laura

 Accepted Answer

I am not certain what solve is in this context.
Plotting the function is straightforward —
syms x y
f(x,y) = 3*x^2 - 6*y^2 + 1
f(x, y) = 
figure
fsurf(f, [-5 5 -5 5])
.

5 Comments

My pleasure!
I am not certain how successful that will be, however one possibility would be —
syms x y
f(x,y) = 3*x^2 - 6*y^2 + 1
f(x, y) = 
S = solve(f, [x,y])
S = struct with fields:
x: [2×1 sym] y: [2×1 sym]
S.x
ans = 
S.y
ans = 
There is one equation in two unknowns, so no unique solution for both ‘x’ and ‘y’ exists. This is the best (and only) possible outcome, other than solving for one in therms of the other.
.
Thank you very much, again!
About your comment, for solving y in terms of x, the procedure would be:
s = solve(f, [y])?
Thank you
My pleasure!
Yes.
syms x y
f(x,y) = 3*x^2 - 6*y^2 + 1
f(x, y) = 
S(y) = solve(f, x)
S(y) = 
S(x) = solve(f, y)
S(x) = 
.
Thank you very much
This was helpful!
As always, my pleasure!
.

Sign in to comment.

More Answers (1)

Thank you very much for your reply, Star Strider.
Sorry, I was unclear.
I meant f(x,y) = 3*x^2 - 6*y^2 + 1 == 0, so I need to find the couple (x,y), real, that very this equation.
Thank you a lot
Laura

Categories

Products

Release

R2021b

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!