该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
实验一MATLAB软件操作
一x=rand(5,7) M=4,N=7 生成一个M*N的矩阵,矩阵元素为0-1之间
x =
0.9501 0.7621 0.6154 0.4057 0.0579 0.2028 0.0153
0.2311 0.4565 0.7919 0.9355 0.3529 0.1987 0.7468
0.6068 0.0185 0.9218 0.9169 0.8132 0.6038 0.4451
0.4860 0.8214 0.7382 0.4103 0.0099 0.2722 0.9318
0.8913 0.4447 0.1763 0.8936 0.1389 0.1988 0.4660
>> b=x(2,:) x矩阵中第二行提取为b
b =
0.2311 0.4565 0.7919 0.9355 0.3529 0.1987 0.7468
c=x(:,5) x矩阵中第五列提取为c
c =
0.0579
0.3529
0.8132
0.0099
0.1389
二
>> a=[1 2 3;4 5 6;7 8 9];b=[2 4 6;1 35;7 9 10]
b =
2 4 6
1 3 5
7 9 10
>> c=a*b
c =
25 37 46
55 85 109
85 133 172
>> d=a.*b
d =
2 8 18
4 15 30
49 72 90
三
(1)>> syms x
>> y=x^2*sin(2*x);
>> r=diff(y,x,50)
r=
689613692941107200*sin(2*x)+56294995342131200*x*cos(2*x)-1125899906842624*x^2*sin(2*x)
syms x y
>> f=exp(x*y)*sin(x*y);
>> diff(f,x)
ans =
y*exp(x*y)*sin(x*y)+exp(x*y)*cos(x*y)*y
(2)>> syms x
>> y=[(x-1)^(1/2)]/x;
>> int(y)
ans =
2*(x-1)^(1/2)-2*atan((x-1)^(1/2))
>> syms x
>> y=x^2+1/x^4;
>> int(y,x,1,2)
ans =
21/8
(3)>> syms d
>> f=1/d+1/(d+1)+1/(d+2);
>> solve(f)
ans =
-1+1/3*3^(1/2)
-1-1/3*3^(1/2)
四
>> t=0:0.01:20;
>> y=exp(-0.5*t).*sin(t-pi/3);
>> plot(t,y)
>>
>> t=0:pi/100:2*pi;
>> y1=cos(t-0.25);y2=sin(t-0.5);
>> plot(t,y1,t,y2)
>>
五
n=input('please input n:')
s=1;
for(i=3:2:(2*n+1))
s=s+i;
end
disp(s);
please input n:5
n =
5
36
实验二控制系统数学建模及分析
实验日期:2017.12.6
实验人员:李成达 自动1402 1410551220
一
>> num=[12 24 0 20];
>> den=[2 4 6 2 2];
>> G=tf(num,den)
Transfer function:
12 s^3 + 24 s^2 + 20
-------------------------------
2 s^4 + 4 s^3 + 6 s^2 + 2 s + 2
二
>> Gk=tf(20,[1 8 36 40 0]);
>> G0=feedback(Gk,1)
Transfer function:
20
--------------------------------
s^4 + 8 s^3 + 36 s^2 + 40 s + 20
>> step(G0)
三
>> num=[1 2 4];
>> den=conv([1,0],conv([1,4],conv([1,6],[11.4 1])));
>> rlocus(num,den)
>>
>> rlocfind(num,den)
Select a point in the graphics window
selected_point =
0.3918 + 4.8487i
ans =
269.5841
四
clear;
clc;
num=[2,1];
den=[1 3 1];
G0=tf(num,den)
Z=roots(num);
P=roots(den);
K=2;
Gzpk=zpk(Z,P,K)
G=feedback(G0,1);
figure(1)
subplot(2,2,1)
bode(G0)
subplot(2,2,2)
nyquist(G0)
subplot(2,2,3)
step(G)
t=0:0.1:10
subplot(2,2,4)
lsim(G,t,t)
clear;
clc;
num=[2,1];
den=[1 3 1 0];
G0=tf(num,den)
Z=roots(num);
P=roots(den);
K=2;
Gzpk=zpk(Z,P,K)
G=feedback(G0,1);
figure(1)
subplot(2,2,1)
bode(G0)
subplot(2,2,2)
nyquist(G0)
subplot(2,2,3)
step(G)
t=0:0.1:10
subplot(2,2,4)
lsim(G,t,t)