필터 지우기
필터 지우기

how to solve a simultaneous equation of 2 variables.

조회 수: 119 (최근 30일)
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2013년 3월 30일
답변: SHREY VERMA 2021년 8월 26일
x+3y=5;2x+4y=4. In general maths, we can be able to find the values of 'x' and 'y' from the above equations. How to find it in MATLAB?

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 30일
If you have the Symbolic toolbox,
syms x y
solve(x + 3*y - 5, 2*x + 4*y - 4)
  댓글 수: 2
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2013년 3월 30일
x: [1x1 sym]
y: [1x1 sym]. this is the answer which i got.. but i want to know the value of x and y.. no values are stored in workspace also
Mandar Parkhi
Mandar Parkhi 2018년 2월 11일
hi walter, how to get symbolic toolbox ?

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Anand
Anand 2013년 3월 30일
A = [1 3;...
2 4;];
b = [5;...
4];
%Solve Ax=b as A\b
X = A\b
>> A\b
ans =
-4
3

Ali Al-khadher
Ali Al-khadher 2019년 3월 14일
%{
ax+by=c....equ(1)
dx+ey=f....equ(2)
A=[a b;d e]
B=[c f]
sol=A/B
x=sol(1)
y=sol(2)
example
3x-9y=-42....equ(1)
2x+4y=2......equ(2)
%}
A = [3 -9;2 4]
b = [-42;2]
%Solve Ax=b as A\b
sol=A\b;
x=sol(1)
y=sol(2)
  댓글 수: 1
Timothy Beckham
Timothy Beckham 2021년 7월 21일
편집: Timothy Beckham 2021년 7월 21일
I am grateful for the solution. I was looking for something similar and came across this page. Thank you very much!

댓글을 달려면 로그인하십시오.


SHREY VERMA
SHREY VERMA 2021년 8월 26일
You can use this file for solving 2, 3, 4 or more variable for solving linear equation, which may consist of real or complex number.

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by