필터 지우기
필터 지우기

Matrix Calculation in MATLAB

조회 수: 19 (최근 30일)
Tanya
Tanya 2014년 2월 16일
편집: Paul 2014년 2월 16일
Could someone help me solve this problem in Matlab.. Suppose I have this Matriks
A=[2-x 5
2 3-x ]
So, it can be written as : (to alculate the determinant)
(2-x * 3-x)-(5*2)=0
But In matlab if I cannot put x before I define it..
There will be an error :
Undefined function or variable 'x'.
Please help me!! How to be able multiply (2-x * 3-x) ?????
I'm not allowed to use det function from Matlab!!!

답변 (2개)

Mischa Kim
Mischa Kim 2014년 2월 16일
편집: Mischa Kim 2014년 2월 16일
Tanya, use symbolic math:
syms x
A = (2-x)*(3-x)
A =
(x - 2)*(x - 3)
or, to solve your problem
A = (2-x)*(3-x) - (5*2);
solve(A)
ans =
41^(1/2)/2 + 5/2
5/2 - 41^(1/2)/2

Paul
Paul 2014년 2월 16일
편집: Paul 2014년 2월 16일
Define x as symbolic variable. Also (2-x * 3-x) should be ((2-x) * (3-x)) else you are calculating (2- (x * 3) -x). So:
syms x
((2-x) * (3-x))-(5*2)
If you want to calculate the values for which the determinant is 0:
x0=solve(((2-x) * (3-x))-(5*2)==0)
double(x0)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by