Convertion of Quadratic form to Cononical form

64 ビュー (過去 30 日間)
sai manideep
sai manideep 2020 年 8 月 20 日
編集済み: Torsten 2023 年 5 月 22 日
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 件のコメント
Debasish Samal
Debasish Samal 2020 年 8 月 24 日
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

サインインしてコメントする。

回答 (2 件)

thode Saiprajwal
thode Saiprajwal 2021 年 4 月 14 日
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
Jayashree 2023 年 5 月 22 日
編集済み: Torsten 2023 年 5 月 22 日
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 :')
eigen values of A are :
disp(d)
disp('orthogonal matrix:')
orthogonal matrix:
disp(m)
disp('canonical form of q is :')
canonical form of q is :
disp(d(1,1)*(y1)^2+d(2,2)*(y2)^2+d(3,3)*(y3)^2)

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by