回答 (1 件)

Jan
Jan 2017 年 10 月 4 日

0 投票

The readers have to guess, what happens in the subfunctions. Not useful.
Perhaps you want:
[L,U,P] = LU_pivot(A);
for k = 1:n
b([k, P(k)]) = b([P(k), k]);
end
"attempt was failed" is a weak description of the problem. Note that it is easier to fix a problem than to guess, what the problem is. I assume you got an error message, because the lower case "p" was undefined, but the upper case "P" is.

1 件のコメント

Jan
Jan 2017 年 10 月 5 日
編集済み: Jan 2017 年 10 月 9 日
Another bold guess is that you want to replace
for k=1:n
b([k,p]) = b([p,k]);
end
by
b = P * b;

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

カテゴリ

質問済み:

2017 年 10 月 4 日

編集済み:

Jan
2017 年 10 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by