MATLAB Answers

How to make a matrix using a column sweep?

7 views (last 30 days)
M Faisal Riyad
M Faisal Riyad on 20 Nov 2015
Edited: dpb on 20 Nov 2015
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


Sign in to comment.

Answers (0)

Sign in to answer this question.


Translated by