Добавил:
mode11
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:файлы матлаб / work 1
.m %%
%task 1
clear,clc
A=rand(3,2)
B=rand(2,3)
C=A*B
dv=C(1:2,1:2)
q=det(dv)
%%
%task 2
clear,clc
A=rand(4,1)
B=rand(1,4)
C=A*B
D=B*A
q=det(C)
%%
%task 3
clear,clc
A=[3,1,9;8,4,2;7,7,5;2,1,3;5,6,3]
B=[5,7;1,8;9,0]
O=zeros(5,2)
B1=B'
E=eye(2)
C=[A,O;B1,E]
q=C(:,5)
%%
%task 4
clear,clc
A=rand(6,3)
A1=A(1:3,1:3)
q=det(A1)
if ~q
A2=inv(A1)
C=A1*A2
end
%%
%task 5
clear,clc
A=rand(3,5)
A1=A(1:3,1:3)
q=det(A1)
A1(1,:)=0
q1=det(A1)
%%
%task 6
clear,clc
A=rand(20,20)
q=eig(A)
b=sort(q)
%%
%task 7
clear,clc
a=rand(4,4)
[a1,a2]=eig(a)
q1=a1*a2
q2=a*a1
%q1=q2
%%
% task 8
clear,clc
A=[1 2 3 2 1 10]
r=roots(A)
P=[0,1-i,5+2i]
val=polyval(A,P)
A1=polyder(A)
val1=polyval(A1,P)
%%
%%task 9
clear,clc
A=rand(3,3)
p=poly(A)
r=sort(roots(p))
mev=sort(eig(A))
%%
%task 10
clear,clc
mev=[7-2i,7+2i,2,1+i,1-i]
p=poly(mev)
a=[p;p;p;p;p;p].*eye(6)
%%
%task 11
clear,clc
figure(1)
x1=0:1:10;
y=4*x1.^3-3;
plot(x1,y)
grid on
hold on
x2=0:0.01:10;
y2=4*x2.^3-3;
plot(x2,y2,'g--')
figure(2)
y3=sin(15*x2+5)-cos(2*x2)
plot(x2,y3,'black'),grid
figure(3)
plot(x1,y,x2,y3),grid
%%
%task 12
clear,clc
w=0.01:0.1:100;
s=i*w;
A=abs((s.^3+2*s.^2+3*s+2)./(s.^4+3*s.^3+2*s.^2+2*s+9));
semilogx(w,A)
%task 1
clear,clc
A=rand(3,2)
B=rand(2,3)
C=A*B
dv=C(1:2,1:2)
q=det(dv)
%%
%task 2
clear,clc
A=rand(4,1)
B=rand(1,4)
C=A*B
D=B*A
q=det(C)
%%
%task 3
clear,clc
A=[3,1,9;8,4,2;7,7,5;2,1,3;5,6,3]
B=[5,7;1,8;9,0]
O=zeros(5,2)
B1=B'
E=eye(2)
C=[A,O;B1,E]
q=C(:,5)
%%
%task 4
clear,clc
A=rand(6,3)
A1=A(1:3,1:3)
q=det(A1)
if ~q
A2=inv(A1)
C=A1*A2
end
%%
%task 5
clear,clc
A=rand(3,5)
A1=A(1:3,1:3)
q=det(A1)
A1(1,:)=0
q1=det(A1)
%%
%task 6
clear,clc
A=rand(20,20)
q=eig(A)
b=sort(q)
%%
%task 7
clear,clc
a=rand(4,4)
[a1,a2]=eig(a)
q1=a1*a2
q2=a*a1
%q1=q2
%%
% task 8
clear,clc
A=[1 2 3 2 1 10]
r=roots(A)
P=[0,1-i,5+2i]
val=polyval(A,P)
A1=polyder(A)
val1=polyval(A1,P)
%%
%%task 9
clear,clc
A=rand(3,3)
p=poly(A)
r=sort(roots(p))
mev=sort(eig(A))
%%
%task 10
clear,clc
mev=[7-2i,7+2i,2,1+i,1-i]
p=poly(mev)
a=[p;p;p;p;p;p].*eye(6)
%%
%task 11
clear,clc
figure(1)
x1=0:1:10;
y=4*x1.^3-3;
plot(x1,y)
grid on
hold on
x2=0:0.01:10;
y2=4*x2.^3-3;
plot(x2,y2,'g--')
figure(2)
y3=sin(15*x2+5)-cos(2*x2)
plot(x2,y3,'black'),grid
figure(3)
plot(x1,y,x2,y3),grid
%%
%task 12
clear,clc
w=0.01:0.1:100;
s=i*w;
A=abs((s.^3+2*s.^2+3*s+2)./(s.^4+3*s.^3+2*s.^2+2*s+9));
semilogx(w,A)