giai he phuong trinh bang matlab.hoangtrieu

spinner.gif

while 1

clear;

clc;

disp ('CHUONG TRINH GIAI HE PHUONG TRINH n AN')

disp ('Sinh vien: Bui To Hoang Trieu')

disp ('Lop: CD DH Dien3_k3')

n=input('ban nhap vao so an cua phuong trinh n=');

while 1

if isempty(n)

n=input('ban nhap lai so an phuong trinh n=');

else

break;

end;

end

disp ('ban nhap cac he so tu trai qua phai tu tren xuong duoi')

for j=1:n

for i=1:n

% disp(['nhap a[' num2str(i) ']=' ])

a(j,i)=input(['nhap a' num2str(j) num2str(i) ' = ']);

if isempty(a(j,i))

break;

end

end

b(j,1)=input(['nhap b' num2str(j) ' = ']);

end

a;

c=inv(a)*b;

disp ('nghiem cua phuong trinh la: ')

for i=1:n

disp (['x' num2str(i) '=' num2str(c(i,1))])

end

r=input('BAN CO MUON TIEP TUC? Y/N [Y]: ','s');

if isempty(r)

r = 'Y';

end

if r=='N'

break

end;

end

clc

clear

Comments & Reviews

Login or Facebook Sign in with Twitter
library_icon_grey.png Add share_icon_grey.png Share

Who's Reading

Recommended