Cap21 M

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

%MATLAB APLICADO A ROBOTICA Y MECATRONICA

%FERNANDO REYES CORTES


%EDITORIAL ALFAOMEGA
clc
clear all
close all
y=[2;4; 9];
A=[ 2, 3.33, 4.56;
8, 12.56, 8.12;
-3, 8.45, - 7.12];
z1=A^(-1)*y;
z2=inv(A)*y;
z3=A\y;
z4=linsolve(A,y);
[m n]=size(A);
detz=[1:m]';
p=0;
for j=1:n
A1=A;
for i=1:m
A1(i,j)=y(i,1);
end
detz(j,1)=det(A1)/det(A);
end
disp('Solucin problema 2.1a')
[z1 z2 z3 z4 detz]

% solucin del problema 2.1b


y=[6;-3; 10.44; 6.12; 0];
A= [1.11, 8.13, 2.14, 6.73, 12.55;
-4, -8.34, 4.67, 4.10, 2.48;
1.2, -5.6, 2.12, -3.24, 12.55;
2.35, 4.5, 5.89, 0.78, 0.34;
0.67, 1.21, -0.98, 0.34, 16.12];
x1=A^(-1)*y;
x2=inv(A)*y;
x3=A\y;
x4=linsolve(A,y);
[m n]=size(A);
detx=[1:m]';
p=0;
for j=1:n
A1=A;
for i=1:m
A1(i,j)=y(i,1);
end
detx(j,1)=det(A1)/det(A);

end
disp('Solucin problema 2.1b')
[x1 x2 x3 x4 detx]

You might also like