Borrar filtros
Borrar filtros

matlab code for preconditioner P

1 visualización (últimos 30 días)
segun egbekunle
segun egbekunle el 26 de Jun. de 2016
Editada: segun egbekunle el 29 de Jun. de 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

Respuestas (1)

Steven Lord
Steven Lord el 27 de Jun. de 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.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by