Вы находитесь на странице: 1из 21

..

: -41

: ..


2015

1


P=1500;L=3.00;Smax=1.8;Smin=1.0;fimax=80;fimin=-20;
%:
%1. ?opt ,
% min
% max , .
%2. "a" "b" .
%3. T = f(?), ?opt Tminmax.
%4. a = f(?), b= f(?), ? = f(?) ?opt.
fi1=fimin*(pi/180); fi2=fimax*(pi/180);
MM=[];
% .
for bet1=64:0.1:80; % .
bet=bet1*(pi/180);
k1=(Smin^2-Smax^2)/(cos(bet+fi2)-cos(bet+fi1)); %
% k1 k2.
k2=k1*cos(bet+fi2)+Smax^2;
fia=-20:0.1:80;
% fi. 1.
%fia=0:2:100;
% 2.
fi=fia*(pi/180);
T=((2*P*L.*sqrt(k2-k1.*cos(bet+fi)))./(k1*sin(bet+fi))).*cos(fi); %
% .
b=((k2+sqrt(k2^2-k1^2))/2)^0.5; % a b.
a=k1/(2*b);
Z=[fi'.*1000 T'];
%
% fi .
[Y,I]=max(Z(:,2));
% Z ( ).
M=[Z(I,:) [a b]*1000]; % [fi T a b].
MM=[MM;M];
%C [fi? T? a? b?]
end
% .
MM;
[Y1,I1]=min(MM(:,2)); % min.
v=64:0.1:80; % ?.
BETopt=v(I1) % ?opt.
Tminmax=Y1 % minmax.
a=MM(I1,3)*0.001 %
b=MM(I1,4)*0.001 % a b.
plot(v,MM(:,2),BETopt,Tminmax,'*'),grid
pause
m1=MM(:,1).*0.001;m2=MM(:,3:4).*0.001;
plot(v,m1,v,m2,v(I1),a,'o',v(I1),b,'o'),grid

:
BETopt = 70.3000; a = 0.5864
Tminmax = 7.9658e+03; b = 1.2670

2
()
% ()
% 14.02.2015.
m1=2500; % ,
m2=320;
% ,
k=10000;
% , /
b=140000; % , *(/)
% :
A=[0
1
0
0
-k/m1 -b/m1 k/m1 b/m1
0
0
0
1
k/m2 b/m2 -2*k/m2 -b/m2];
B=[0
0
1
0
0
0
0
k/m2];
C=[1 0 -1 0];
D=[0 0];
% :
step(A, 0.1*B, C, D, 2),grid
axis([0 10 -.01 .01])
%pause
%====================================
%
%[nump,denp]=ss2tf(A, B, C, D, 1)
%nump=[nump(3) nump(4) nump(5)]
%[num1,den1]=ss2tf(A,B,C,D,2)
%num1=[num1(3) num1(4) num1(5)];
%=================================
%
% . 1,..., 4
% %,
% 1,..., 4 .
% , .
%
p1 = -5 + 5i;
p2 = -5 - 5i;
p3 = -20;
p4 = -100;
%
%p1=-10+10i;
%p2=-10-10i;
%p3=-50;

%p4=-200;
K = place(A,B*[1,0]',[p1 p2 p3 p4]);
% Plotting the closed-loop response
t=0:0.01:1;
step(A-B*[1,0]'*K,0.1*B,C,D,2,t),grid
axis([0 1 -.01 .01])
:

% sah836a.m
% ()
% .
% 14.02.2015.
m1=2500; % ,
m2=320;
% ,
k=10000;
% , /
b=140000; % , *(/)
% :
A=[0
1
0
0
-k/m1 -b/m1 k/m1 b/m1
0
0
0
1
k/m2 b/m2 -2*k/m2 -b/m2];
B=[0
0
1
0

0
0
0
k/m2];
C=[1 0 -1 0];
D=[0 0];
% :
step(A, 0.1*B, C, D, 2),grid
axis([0 10 -.01 .01])
%pause
%====================================
%
%[nump,denp]=ss2tf(A, B, C, D, 1)
%nump=[nump(3) nump(4) nump(5)]
%[num1,den1]=ss2tf(A,B,C,D,2)
%num1=[num1(3) num1(4) num1(5)];
%=================================
%
% . 1,..., 4
% %,
% 1,..., 4 .
% , .
%
p1 = -5 + 5i;
p2 = -5 - 5i;
p3 = -20;
p4 = -100;
%
%p1=-10+10i;
%p2=-10-10i;
%p3=-50;
%p4=-200;
K = place(A,B*[1,0]',[p1 p2 p3 p4]);
% Plotting the closed-loop response
t=0:0.01:1;
step(A-B*[1,0]'*K,0.1*B,C,D,2,t),grid;
%axis([0 1 -.01 .01])
%========================================================
Ac=A-B*[1 0]'*K; B*[1 0]'; C; D1=[0];
sys1=ss(Ac,B*[0 1]',C,D1)
t=0:0.01:5;
k=size(t);
x0=[0 0 0 0]';
u=0.05*sin(5*t)+0.05*sin(3*5*t)+0.05*randn(1,k(2));
[y,t,x]=lsim(sys1,u,t,x0);
subplot(2,1,1)
plot(t,u),grid

subplot(2,1,2)
plot(t,y),grid

3

:
global g L
g=9.81; L=1.0;
% - .
[ta,xa]=ode45('BorErm3a',[0 5],[0.4 0]);
% - .
[tb,xb]=ode45('BorErm3a',[0 5],[0.8*pi 0]);
% - .
plot(ta,xa(:,1),tb,xb(:,1)),grid
xlabel('Time (s)'),ylabel('Angle (rad)')
%% gtext(' Case 1'),gtext(' Case 2')
% initial:
A=[0 1;-g/L 0];B=[1 1]';C=[1 0;0 1]; D=[0 0]';
tet0=[0.4 0]'; dt=0.1; Tf=5;
t=0:dt:Tf;
sys1=ss(A,B,C,D)
[y,t,tet]=initial(sys1,tet0,t);
plot(ta,xa(:,1),ta,xa(:,2),tb,xb(:,1),t,tet(:,1),t,tet(:,2),'.'),grid
% , ,
%
% , .
% - - % sah511.m
function fx=sah512(t,x);
global g L
fx=[x(2);-(g/L)*sin(x(1))];

:
global g L
g=9.81; L=3.0;
% - .
[ta,xa]=ode45('BorErm3a',[0 5],[0.4 0]);
% - .
[tb,xb]=ode45('BorErm3a',[0 5],[0.8*pi 0]);
% - .
plot(ta,xa(:,1),tb,xb(:,1)),grid
xlabel('Time (s)'),ylabel('Angle (rad)')
%% gtext(' Case 1'),gtext(' Case 2')
% initial:
A=[0 1;-g/L 0];B=[1 1]';C=[1 0;0 1]; D=[0 0]';
tet0=[0.4 0]'; dt=0.1; Tf=5;
t=0:dt:Tf;
sys1=ss(A,B,C,D)
[y,t,tet]=initial(sys1,tet0,t);
plot(ta,xa(:,1),ta,xa(:,2),tb,xb(:,1),t,tet(:,1),t,tet(:,2),'.'),grid
% , ,
%
% , .

:
global g L
g=9.81; L=9.0;
% - .
[ta,xa]=ode45('BorErm3a',[0 5],[0.4 0]);
% - .
[tb,xb]=ode45('BorErm3a',[0 5],[0.8*pi 0]);
% - .
plot(ta,xa(:,1),tb,xb(:,1)),grid
xlabel('Time (s)'),ylabel('Angle (rad)')
%% gtext(' Case 1'),gtext(' Case 2')
% initial:
A=[0 1;-g/L 0];B=[1 1]';C=[1 0;0 1]; D=[0 0]';
tet0=[0.4 0]'; dt=0.1; Tf=5;
t=0:dt:Tf;
sys1=ss(A,B,C,D)
[y,t,tet]=initial(sys1,tet0,t);
plot(ta,xa(:,1),ta,xa(:,2),tb,xb(:,1),t,tet(:,1),t,tet(:,2),'.'),grid
% , ,
%
% , .

4
.
w=0.8;
ksi=4;
sys1=tf(w^2,[1 2*ksi*w w^2])
eig(sys1)
step(sys1),grid
pause
%

% 2-
%1 ()
%
% 2- ,
%
%
wn=realp('wn',4);
zeta=realp('zeta',0.6);
F=tf(wn^2,[1 2*zeta*wn wn^2]);
F2=tf(F)
pause
%F
% wn zeta , 4,0.6
%2.1 F 2x3 wn zeta
%Fsample=replaceBlock(F,'wn',[4 4.5 5]','zeta',[0.6 0.8]);
Fsample=replaceBlock(F,'wn',[4]','zeta',[0.6]);
eig(Fsample)
step(Fsample),grid
%3.1 Fsample
[y,t,x]=step(Fsample)
pause
plot(t,x(:,1)*0.5,'r',t,x(:,2)),grid
impulse(Fsample),grid

sys1 =
0.64

-----------------s^2 + 6.4 s + 0.64


Continuous-time transfer function.
ans = -6.2984
-0.1016
F2 =
16
---------------s^2 + 4.8 s + 16
Continuous-time transfer function.
ans =
-2.4000 + 3.2000i
-2.4000 - 3.2000i
x=
0
0.0183
0.0349
0.0499
0.0632
0.0750
0.0854
0.0943
0.1020
0.1084
0.1136
0.1177
0.1208
0.1230
0.1242
0.1247
0.1244
0.1235
0.1219
0.1198

0
0.0002
0.0007
0.0015
0.0026
0.0039
0.0055
0.0072
0.0091
0.0111
0.0132
0.0154
0.0177
0.0201
0.0225
0.0248
0.0272
0.0296
0.0320
0.0343

0.1172
0.1141
0.1107
0.1070
0.1030
0.0988
0.0943
0.0898
0.0851
0.0804
0.0756
0.0709
0.0661
0.0614
0.0568
0.0522
0.0478
0.0435
0.0393
0.0352
0.0314
0.0276
0.0241
0.0207
0.0175
0.0145
0.0117
0.0091
0.0066
0.0043
0.0022
0.0003
-0.0015
-0.0031
-0.0045
-0.0058
-0.0069
-0.0079
-0.0088
-0.0096
-0.0102
-0.0107
-0.0111
-0.0114
-0.0116

0.0366
0.0388
0.0409
0.0430
0.0450
0.0470
0.0488
0.0506
0.0523
0.0539
0.0554
0.0568
0.0581
0.0593
0.0604
0.0615
0.0624
0.0633
0.0641
0.0648
0.0655
0.0660
0.0665
0.0670
0.0673
0.0676
0.0679
0.0681
0.0682
0.0683
0.0684
0.0684
0.0684
0.0684
0.0683
0.0682
0.0681
0.0679
0.0678
0.0676
0.0674
0.0672
0.0670
0.0668
0.0666

-0.0118
-0.0118
-0.0118
-0.0117
-0.0116
-0.0114
-0.0111
-0.0109
-0.0106
-0.0102
-0.0098
-0.0094
-0.0090
-0.0086
-0.0081
-0.0077
-0.0072
-0.0068
-0.0063
-0.0059
-0.0055
-0.0050
-0.0046
-0.0042
-0.0038
-0.0034
-0.0030
-0.0027
-0.0023
-0.0020
-0.0017
-0.0014
-0.0012
-0.0009
-0.0007
-0.0004
-0.0002
-0.0001
0.0001

0.0663
0.0661
0.0659
0.0657
0.0654
0.0652
0.0650
0.0648
0.0646
0.0644
0.0642
0.0640
0.0638
0.0637
0.0635
0.0633
0.0632
0.0631
0.0629
0.0628
0.0627
0.0626
0.0625
0.0624
0.0624
0.0623
0.0622
0.0622
0.0621
0.0621
0.0620
0.0620
0.0620
0.0620
0.0620
0.0619
0.0619
0.0619
0.0619

5

4-
% .
clear
global m1 m2 c1 c2 k1 k2
m1=40; m2=60;
c1=0; c2=0;
%c1=9; c2=10;
k1=7; k2=5;
t10=0;
t1f=80;
y0=[1 0 0 0]';
[t1,y]=ode45('sah842',[t10 t1f],y0);
plot(t1,y(:,1),t1,y(:,2)),grid
xlabel('')
ylabel(' ')
A=[0 0 1 0;0 0 0 1;-k1/m1 k1/m1 -c1/m1 c1/m1;
k1/m2 -(k1+k2)/m2 c1/m2 -(c1+c2)/m2];
%B=[0 0;0 0;1/m1 0;0 1/m2];
b=[0 0 0 1/m2]';
b1=[0 0 1/m1 0]';
% sah842.m
% -. - sah756g.m
function yf=sah842(t1,y);
global m1 m2 c1 c2 k1 k2
A=[0 0 1 0;0 0 0 1;-k1/m1 k1/m1 -c1/m1 c1/m1;
k1/m2 -(k1+k2)/m2 c1/m2 -(c1+c2)/m2];
B=[0 0;0 0;1/m1 0;0 1/m2];
r=size(t1);
yf=A*y+[0 0 1/m1 0]'.*0;
%sin(t1)+[0 0 0 1/m2]'.*0.0*t1;

1=0; 2=0;

1=0,4; 2=0,4;

1=10; 2=10;