How to make a matrix using a column sweep?
조회 수: 2 (최근 30일)
이전 댓글 표시
I am a new user in Matlab. I derived a set of following equations:
A(i,j)*alpha/dt - A(i,j+1)*gamma/dt - A(i,j-1)*delta/dt = A(i-1,j)*beta/dt
I declared a rectangular matrix of A with initial zero values for all the row and columns. Declared all the coefficients and now i want to set all the values for all nodes in the matrix except the boundary rows and columns i.e. 1st and last column and row. My code is not working. Could anyone help me in setting up the matrix.
%for the inner nodes
for i = 2:(N-1)
for j = 2:(M-1)
A(i,j) = alpha/dt
A(i-1,j) = beta/dt
A(i,j+1) = gamma/dt
A(i,j-1) = delta/dt
end
end
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Assembly에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!