Effacer les filtres
Effacer les filtres

matlab code for preconditioner P

1 vue (au cours des 30 derniers jours)
segun egbekunle
segun egbekunle le 26 Juin 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

Réponses (1)

Steven Lord
Steven Lord le 27 Juin 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.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by