Azzera filtri
Azzera filtri

Large Matrices for solving linear systems

3 visualizzazioni (ultimi 30 giorni)
Can someone help me, I need to create the pentagonal matrix associated with the Laplace equation.. So -4 along the diagonal and 4 diagonals with 1’s. I want to be able to change the size, initially I was wanting N=33, hence 1024 x 1024.
Also an array with different values, I know I can do b=(ones(N-1)*(N-1),1) with ones or zeros, but is there a way to create a large array with different values.
I have codes for all my methods of solving linear systems, just cant create a matrix A
  1 Commento
Torsten
Torsten il 3 Dic 2018
You should think about whether it is necessary to form the matrix explicitly. If N gets larger, this may cause problems with available workspace.

Accedi per commentare.

Risposta accettata

Steven Lord
Steven Lord il 3 Dic 2018
I think you may find this documentation example useful.

Più risposte (3)

KSSV
KSSV il 3 Dic 2018
N = 10 ;
A = diag(ones(N-2,1),-2)+diag(ones(N-1,1),-1)+4*diag(ones(N,1))+........
diag(ones(N-1,1),1)+diag(ones(N-2,1),2) ;
  1 Commento
JJ
JJ il 3 Dic 2018
thanks thins is similar to what I want but I need the specific pentagonal matrix associated with the discrete Laplace equation

Accedi per commentare.


Walter Roberson
Walter Roberson il 3 Dic 2018
spdiags() to create the A matrix .
There is no special way to create large dense matrices.

Matt J
Matt J il 3 Dic 2018
Modificato: Matt J il 3 Dic 2018
values=[-4,1,1,1,1];
A=toeplitz([values(:), zeros(N-numel(values),1) ]);

Categorie

Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by