Large Matrices for solving linear systems
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Torsten
2018-12-3
You should think about whether it is necessary to form the matrix explicitly. If N gets larger, this may cause problems with available workspace.
采纳的回答
更多回答(3 个)
KSSV
2018-12-3
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) ;
Walter Roberson
2018-12-3
spdiags() to create the A matrix .
There is no special way to create large dense matrices.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!