- 1、本文档共8页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
matlab实验4,5,8
实验四:线性方程组的求解(2课时)
参考程序:
方法一:A=[7 14 -9 -2 5;3 -15 -13 -6 -4;-11 -9 -2 5 7;5 7 14 16 -2;-2 5 12 -11 -4]
B=[100;200;300;400;500]
X=A\B
X =
370.9455
-224.7276
238.3333
-138.1891
503.6378
方法二:
[x1,x2,x3,x4,x5]=solve(7*x1+14*x2-9*x3-2*x4+5*x5=100,3*x1-15*x2-13*x3-6*x4-4*x5+200,-11*x1-9*x2-2*x3+5*x4+7*x5=300,5*x1+7*x2+14*x3+16*x4-2*x5=400,-2*x1+5*x2+12*x3-11*x4-4*x5=500,x1,x2,x3,x4,x5)
x1 =
115735/312
x2 =
-70115/312
x3 =
715/3
x4 =
-43115/312
x5 =
157135/312
2.参考程序:
A=[6 9 14 -11 5;1 14 -7 -15 -6;-2 1 -7 12 -1;6 11 11 -9 -13]
B=[68;294;-441;103]
X=A\B
X =[X1; X2; X3; X4; X5]
0
-26.3759
-5.4126
-38.3960
-8.2392
3.参考程序:
A=[0 0 -1 0;0 20 40 0;60 0 40 0;0 0 40 40];
B=[0;10;50;-40];
I=A\B
I =[Ia Ib Ic Id]
0.8333
0.5000
0
-1.0000
实验五:函数编写与程序设计(2课时)
参考程序:
function [y,y1,y2]=mwave(f1,m1,f2,m2)
t=0:2*pi/(500-1):2*pi;
y1=m1*sin(2*pi*f1*t);
y2=m2*sin(2*pi*f2*t);
y=y1+y2;
figure
subplot(311); plot(t,y1); title(y12¨D?);
subplot(312); plot(t,y2); title(y22¨D?);
subplot(313); plot(t,y); title(y=y1+y22¨D?);
[y,y1,y2]=mwave(2,20,05,2)
2.
a=1;
s=0
for i=1:64
s=s+a;
a=2*a;
end
n=s/1.4/10^8
s =
0
n =
1.3176e+011
3. for x=0:19
for y=0:33
for z=0:100
if (x+y+z==100)(5*x+3*y+z/3==100)
d=[x,y,z]
end
end
end
end
d =
0 25 75
d =
4 18 78
d =
8 11 81
d =
12 4 84
实验八:线性时不变系统的时域响应
1.参考程序:
x=[zeros(1,4),1,zeros(1,15)];
subplot(1,2,1)
stem(k,x)
y=[zeros(1,4),ones(1,16)]
subplot(1,2,2)
stem(k,y)
参考程序:
f=2;
t=0:0.001:2;
w=2*pi*f*t;
y=square(w,30)
axis([0 2 0 2]);
hold on
plot(t,y)
参考程序:
k=0.5;
z=[1,-3];
p=[-1,-2,-4];
sys_zpk=zpk(z,p,k)
Zero/pole/gain:
0.5 (s-1) (s+3)
-----------------
(s+1) (s+2) (s+4)
[b,a]=zp2tf(z,p,k);
sys_tf=tf(b,a)
Transfer function:
0.5 s^2 + s - 1.5
----------------------
s^3 + 7 s^2 + 14 s + 8
文档评论(0)