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

조회 수: 2 (최근 30일)
Denis Chin
Denis Chin 2014년 7월 16일
댓글: Denis Chin 2014년 7월 16일
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일
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;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by