필터 지우기
필터 지우기

how to optimize a diag matrix with sparse

조회 수: 1 (최근 30일)
Dimitrios
Dimitrios 2014년 6월 5일
답변: James Tursa 2014년 6월 5일
How to optimize this diagonal matrix using sparse :
a=diag([-ones(9,1)],-1)+diag([ones(10,1)])+diag([0 ones(1,4) 0],4)

답변 (1개)

James Tursa
James Tursa 2014년 6월 5일
If you mean how to create the equivalent sparse matrix to your full matrix shown, try using the spdiags function instead of diag.

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by