Jacobi method in matlab

3 vues (au cours des 30 derniers jours)
steve Brian
steve Brian le 9 Avr 2020
Modifié(e) : steve Brian le 9 Avr 2020
Hi there, I'm at the beginning and I don't know how to work with matrices.
I have a function that receives as a parameter, a matrix in the form of CSR, an iteration vector and a tolerance
My function is of form: function [x] = jacobi_sparse (values, colomn, rowptr, c, tol) %1
I create a function which multiplies a matrix A in the form csr (A) with a vector(x), like this: (y = Ax)
function [y] = csr_multiplication(values, colind, rowptr, x) %2
n = length(x);
y = zeros(n, 1);
for i = 1:n
for j = rowptr(i):rowptr(i+1) - 1
y(i) = y(i) + values(j) * x(colind(j));
end
end
endfunction
The function I want to implement %1, i want to use my %2 to return value of x.
tol - is the tolerance under which iterations stop.
The initial vector with which the solution is approximated is 0
It is something like the Jacobian method, and function %1 need to return x, base on function %2.
Please help me, thanks a lot!

Réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by