matlab code for preconditioner P

3 ビュー (過去 30 日間)
segun egbekunle
segun egbekunle 2016 年 6 月 26 日
編集済み: segun egbekunle 2016 年 6 月 29 日
Matlab code for preconditioner P Given a linear equation of the form Ax=b For example where A=[6 2 4;3 4 3; 3 1 2] and b=[26 19 13]' A =
6 2 4
3 4 3
3 1 2
b =
26
19
13
I need matlab code for a preconditional P such that
P=
1 -2/A(2,2) 0
0 1 -3/A(3,3)
0 0 1
P= 1 -0.5 0 0 1 -1.5 0 0 1
2. I need a matlab code to convert the main diagonal of a matrix to one for example A= 6 2 4 3 4 3 3 1 2 F== 1 2/6 4/6 3/4 1 3/4 3/2 1/2 1

回答 (1 件)

Steven Lord
Steven Lord 2016 年 6 月 27 日
Replace "a22" in your expression for P with "A(2, 2)" [and similarly for a33] and add in some square brackets, maybe some semicolons and/or commas to make it explicit what matrix you're creating, and you should be all set.
For part 2, I'll just give you a hint: look at the diag function.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by