For loop - Gaussian elimination

Hi guys and girls. Please could you assist me in understanding the for loop section in the following code (as a m file in the editor):
function x = Gauss(a,b)
ab = [a,b]
[R, C] = size(ab)
for j = 1:R-1
for i = j + 1:R
ab(i,j:C) = ab(i,j:C)-ab(i,j)/ab(j,j)*ab(j,j:C)
end
the left side is the function ab for loops i.j:C (i think). It means that you can call up ab and it will look at inputs i,j:C? How does Matlab look at the right side? Sorry i am new to Matlab and struggling some late hours here...

1 件のコメント

Geoff Hayes
Geoff Hayes 2015 年 2 月 22 日
S - the left-side of the assignment
ab(i,j:C)
means that columns j through C of row i will be updated with right-hand side of the assignment which is just
ab(i,j:C)-ab(i,j)/ab(j,j)*ab(j,j:C)
Is this code that you have written or obtained from somewhere? While it has some of the steps from gaussian elimination it seems to be incomplete.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

質問済み:

2015 年 2 月 22 日

コメント済み:

2015 年 2 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by