Jacobi method in matlab

3 Ansichten (letzte 30 Tage)
steve Brian
steve Brian am 9 Apr. 2020
Bearbeitet: steve Brian am 9 Apr. 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!

Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by