clc;
clear;

% ساخت ماتریس هیلبرت
A = hilb(10);

% محاسبه عدد حالت
c = cond(A);

% ساخت بردار b
b = randn(10,1);

% حل با روش معکوس
x1 = inv(A)*b;

% حل با روش بک اسلش
x2 = A\b;

% محاسبه خطای دو روش
error1 = norm(A*x1-b);
error2 = norm(A*x2-b);

% نمایش نتایج
disp(c);
disp(error1);
disp(error2);

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: