Convertion of Quadratic form to Cononical form
65 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Using MATLAB code to transform the quadratic form 3*(x1)^2 + 5*(x2)^2 + 3*(x3)^2 − 2*(x2)*(x3) +2*(x3)*(x1) − 2*(x1)*(x2) to canonical form and specify the matrix of transformation.
1 commentaire
Debasish Samal
le 24 Août 2020
Hello Sai,
You can use the Symbolic math toolbox to solve this problem.
>> Q = 3*(x1)^2 + 5*(x2)^2 + 3*(x3)^2 - 2*(x2)*(x3) +2*(x3)*(x1) - 2*(x1)*(x2);
>> X = [x1 x2 x3];
>> H = hessian(Q)/2;
H =
[ 3, -1, 1]
[ -1, 5, -1]
[ 1, -1, 3]
Please refer the URL below for proper explantion:
https://www.mathworks.com/matlabcentral/answers/445266-polynomial-to-matrix-form-canonical-form?s_tid=answers_rc1-2_p2_MLT
Réponses (2)
thode Saiprajwal
le 14 Avr 2021
clc
clear
syms x1 x2 x3 y1 y2 y3
q=input('enter a quadratic form in terms of x1,x2,x3');
a11=(diff(diff(q,x1),x1))/2;
a22=(diff(diff(q,x2),x2))/2;
a33=(diff(diff(q,x3),x3))/2;
a12=(diff(diff(q,x1),x2))/2;
a13=(diff(diff(q,x1),x3))/2;
a23=(diff(diff(q,x2),x3))/2;
A=[a11,a12,a13;a12,a22,a23;a13,a23,a33];
[m,d]=eig(A);
disp('eigen values of A are :')
disp(d)
disp('orthogonal matrix:')
disp(m)
disp('canonical form of q is :')
disp(d(1,1)*(y1)^2+d(2,2)*(y2)^2+d(3,3)*(y3)^2)
Jayashree
le 22 Mai 2023
Modifié(e) : Torsten
le 22 Mai 2023
clc
clear
syms x1 x2 x3 y1 y2 y3
%q=input('enter a quadratic form in terms of x1,x2,x3');
q=3*(x1)^2 + 5*(x2)^2 + 3*(x3)^2 - 2*(x2)*(x3)+2*(x3)*(x1) - 2*(x1)*(x2);
a11=(diff(diff(q,x1),x1))/2;
a22=(diff(diff(q,x2),x2))/2;
a33=(diff(diff(q,x3),x3))/2;
a12=(diff(diff(q,x1),x2))/2;
a13=(diff(diff(q,x1),x3))/2;
a23=(diff(diff(q,x2),x3))/2;
A=[a11,a12,a13;a12,a22,a23;a13,a23,a33];
[m,d]=eig(A);
disp('eigen values of A are :')
disp(d)
disp('orthogonal matrix:')
disp(m)
disp('canonical form of q is :')
disp(d(1,1)*(y1)^2+d(2,2)*(y2)^2+d(3,3)*(y3)^2)
0 commentaires
Voir également
Catégories
En savoir plus sur Number Theory dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!