Toto je starší verze dokumentu!


Cvičení 7

Řešení druhé části cvičení pomocí QR rozkladu

%
% Function which solves Ax = b system of equations using QR decomposition
%
% Author: Martin Vejmelka <[email protected]>
%
 
function [ x ] = get_solution( A, b )
 
    % determining solution size
    asize = size(A);
    result_vector_size = asize(2);
 
    % QR decomposition
    [Q1, R] = qr(A, 0);
 
    % vector being counted
    x = zeros(result_vector_size, 1);
 
    % right side
    b2 = Q1' * b;
 
    % iterating through values in x and counting x
    for i = result_vector_size:-1:1
        x(i) = (b2(i) - (R(i,:) * x)) / R(i, i);
    end
 
end
courses/a4b33opt/cviceni7.1257435785.txt.gz · Poslední úprava: 2025/01/03 18:23 (upraveno mimo DokuWiki)
Nahoru
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0