How to solve this equation?

10 ビュー (過去 30 日間)
Steve
Steve 2015 年 1 月 25 日
回答済み: Steve 2015 年 1 月 25 日
Hi there,
This should be an easy question but somehow it doesn't work...
How can I solve this using matrices?
3x-2y=17 5x+3y=3
Thanks for any solutions!

採用された回答

Matz Johansson Bergström
Matz Johansson Bergström 2015 年 1 月 25 日
編集済み: Matz Johansson Bergström 2015 年 1 月 25 日
This is actually very simple using the \ operator, see mldivide,\ documentation
A = [3, -2; 5, 3];
b = [17, 3]';
A\b
  1 件のコメント
Matz Johansson Bergström
Matz Johansson Bergström 2015 年 1 月 25 日
編集済み: Matz Johansson Bergström 2015 年 1 月 25 日
Also, we can easily verify that it is correct
x = 0:5;
y1 = (3*x - 17)/2;
y2 = (-5*x + 3)/3;
close all
hold on
plot(x, y1, 'k', 'linewidth',2)
plot(x, y2, 'b', 'linewidth',2)
A = [3, -2; 5, 3];
b = [17, 3]';
xy = A\b % solve Ax=b for x
plot(xy(1), xy(2), 'Or', 'linewidth', 4) %the solution

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

その他の回答 (1 件)

Steve
Steve 2015 年 1 月 25 日
Great thank you! You helped me a lot! =)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by