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 CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by