Jacobi Iterative Method in Matlab - MATLAB Answers - MATLAB Central
Jacobi Iterative Method in Matlab - MATLAB Answers - MATLAB Central
MATLAB Answers™
Related Content
MATLAB Answers
Jacobi method in
MATLAB
Flag
Vote
Follow 1 Answer
0
Products
MATLAB
1 Comment
lubna ineirat on 28 Jun 2016
Four Steps to
Building Smarter
RF Systems with
MATLAB
1 Answer
Download white
paper
Vote
6
Flag Link
Answer by Bruno Pop-Stefanov on 8 Oct 2014
x = zeros(n,1);
before the first for loop. That way you can also control that x will be a
column vector (or a row vector if you use zeros(1,n)) and you do not
need to transpose x after the loop.
x_ny = zeros(n,1);
You might actually be able to vectorize these for loops, if you find a
way to rewrite lines 4 and 10.
http://www.mathworks.com/help/matlab/matlab_prog/techniques-for-
improving-performance.html
http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html
I am not familiar with the Jacobi method, but I would avoid using inv.
Calculating the inverse of a matrix numerically is a risky operation
when the matrix is badly conditioned. It's also slower and less precise
than other linear solvers. Instead, use mldivide to solve a system of
linear equations. Based on how the system looks like, mldivide will
choose an appropriate method.
x(k+1) = D \ (b - (L+U)*x(k));
https://in.mathworks.com/matlabcentral/answers/157632-jacobi-iterative-method-in-matlab 2/3
8/21/2018 Jacobi iterative method in matlab - MATLAB Answers - MATLAB Central
1 Comment
Rafid Jabbar on 15 May 2017
Dears, Please could one answer me, how I can solve below
equation numerically by Jacobi method to get temperature
distribution along z-axis, 1D problem, steady state: (
PreviewDisable
Cancel Submit
mathworks.com
© 1994-2018 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks
of their respective holders.
https://in.mathworks.com/matlabcentral/answers/157632-jacobi-iterative-method-in-matlab 3/3