How to solve 3 equations with 3 unknowns using 'for' loop?

Here is my 3 equation:
y=(4+2x-3z)/5
x=(3-2y-z)/4
z=(13+y-2x)/4
I have to use 'for' loop and perform 30 iterations, how can I do that in matlab? Can someone please help me?

1 件のコメント

Jasmine
Jasmine 2014 年 7 月 16 日
If you simply need to know how to use a for loop thirty times, use a variable called count.
count = 1;
for count = 1:30
[your code]
end
Or are you asking how to solve the simultaneous equations?

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

 採用された回答

lvn
lvn 2014 年 7 月 16 日
編集済み: lvn 2014 年 7 月 16 日

0 投票

I guess you are meant to solve these equations by iteration? Something like this would do
x=1;y=1;z=1;
for l=1:30
y=(4+2*x-3*z)/5
x=(3-2*y-z)/4
z=(13+y-2*x)/4
end;

1 件のコメント

Denis Chin
Denis Chin 2014 年 7 月 16 日
thank you so much Ivn!! Much appreciated

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

質問済み:

2014 年 7 月 16 日

コメント済み:

2014 年 7 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by