www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/LinearSystemwithSparseMatrixExample.m

    %% Linear System with Sparse Matrix  
% Solve a simple system of linear equations using sparse matrices.   

%% 
% Consider the matrix equation |A*x = B|. 
A = sparse([0 2 0 1 0; 4 -1 -1 0 0; 0 0 0 3 -6; -2 0 0 0 2; 0 0 4 2 0]);
B = sparse([8; -1; -18; 8; 20]);
x = A\B