How to make a matrix using a column sweep?

조회 수: 2 (최근 30일)
M Faisal Riyad
M Faisal Riyad 2015년 11월 20일
편집: dpb 2015년 11월 20일
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개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by