quadratic curve from matrices determinant

1 次查看(过去 30 天)
Hello everyone,
could someone help me please?
I would like to obtain the quadratic curve coming from the calculation of a 2x2 matrix determinant.
This is what I wrote in my code:
h = @(x,y,z) 3.*(x+5).^2 + (x + 5).*(y - 2) + (y - 2).^2;
syms x y z
w = h(x,y,z)
g = @(x,y,z) (x - 5).^2 - (x - 5).*(y - 3) + (y - 3).^2;
syms x y z
w1 = g(x,y,z)
Dhx = diff(h,x)
Dhy = diff(h,y)
Dgx = diff(h,x)
Dgy = diff(h,y)
p1 = Dhx * Dgy
expand(p1)
p2 = Dhx * Dgy
expand(p2)
exp1 = expand(p1)
exp2 = expand(p2)
Now I should do the difference between exp1 and exp2, but I can't do it.
I am new with the symbolic toolbox, so I have difficulties to pass from symbolic expressions to numerical values.
I guess there is a faster way to calculate the determinant of my matrix and thus get the quadratic function but I don't really know how to find it.
Thank you very much for your support!
Laura
  3 个评论
Catalytic
Catalytic 2021-6-14
You have a number of previous posts that you have not accepted answers to, though the answers seem to be fine. It is a disincentive for people to help you.
laura bagnale
laura bagnale 2021-6-14
Oh OK, thank you very much.
I'm very sorry but I'm new and I didn't understand that it was important!
Thank you again!
Laura

请先登录,再进行评论。

回答(1 个)

Ishu
Ishu 2024-5-5
Hi Laura
I understand that you want to determine the type of quadratic curve from a given quadratic curve with the help of matrix determinat.
If you have a quadratic curve of the form "Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0" then the matrix representation of the quadratic part is [A, B/2; B/2, C]. From this matrix you can calculate the deteminant of the equation. If the determinat is less than 0 then the curve is a "hyperbola" and if determinat is greater than zero then the curve is "ellipse".
%Example on how to calculate determinant.
% Define the coefficients of the quadratic equation
A = -8; B = 8; C = 4; D = -29; E = 70; F = -21;
% Construct the matrix Q
Q = [A, B/2; B/2, C];
% Calculate the determinant of Q
detQ = det(Q);
Hope it helps!

类别

Help CenterFile Exchange 中查找有关 Quadratic Programming and Cone Programming 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by