matlab code for preconditioner P

3 Ansichten (letzte 30 Tage)
segun egbekunle
segun egbekunle am 26 Jun. 2016
Bearbeitet: segun egbekunle am 29 Jun. 2016
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

Antworten (1)

Steven Lord
Steven Lord am 27 Jun. 2016
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.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by