《控制系统计算机辅助设计:MATLAB语言与应用(第2版)》薛定宇 - 课后习题答案 - 图文 下载本文

内容发布更新时间 : 2024/5/4 17:32:29星期一 下面是文章的全部内容请认真阅读。

δ=0.05

δ=0.7

结论:随着非线性环节的死区增大,阶跃响应曲线的范围逐渐被压缩,可以想象当死区δ足够大时,将不再会有任何响应产生。所以可以得到结论,在该非线性系统中,死区的大小可以改变阶跃响应的幅值和超调量。死区越大,幅值、超调量将越小,而调整时间几乎不受其影响

6

第2章 MATLAB语言程序设计基础

【1】

>> A=[1 2 3 4;4 3 2 1;2 3 4 1;3 2 4 1] A =

1 2 3 4 4 3 2 1 2 3 4 1 3 2 4 1

>> B=[1+4i,2+3i,3+2i,4+i;4+i,3+2i,2+3i,1+4i;2+3i,3+2i,4+i,1+4i;3+2i,2+3i,4+i,1+4i] B =

1.0000 + 4.0000i 2.0000 + 3.0000i 3.0000 + 2.0000i 4.0000 + 1.0000i 4.0000 + 1.0000i 3.0000 + 2.0000i 2.0000 + 3.0000i 1.0000 + 4.0000i 2.0000 + 3.0000i 3.0000 + 2.0000i 4.0000 + 1.0000i 1.0000 + 4.0000i 3.0000 + 2.0000i 2.0000 + 3.0000i 4.0000 + 1.0000i 1.0000 + 4.0000i >> A(5,6)=5 A =

1 2 3 4 0 0 4 3 2 1 0 0 2 3 4 1 0 0 3 2 4 1 0 0 0 0 0 0 0 5

∴若给出命令A(5,6)=5则矩阵A的第5行6列将会赋值为5,且其余空出部分均补上0作为新的矩阵A,此时其阶数为5×6

【2】

相应的MATLAB命令:B=A(2:2:end,:) >> A=magic(8) A =

64 2 3 61 60 6 7 57 9 55 54 12 13 51 50 16 17 47 46 20 21 43 42 24 40 26 27 37 36 30 31 33 32 34 35 29 28 38 39 25 41 23 22 44 45 19 18 48 49 15 14 52 53 11 10 56 8 58 59 5 4 62 63 1 >> B=A(2:2:end,:) B =

9 55 54 12 13 51 50 16 40 26 27 37 36 30 31 33 41 23 22 44 45 19 18 48 8 58 59 5 4 62 63 1 ∴从上面的运行结果可以看出,该命令的结果是正确的

7

【3】

>> syms x s; f=x^5+3*x^4+4*x^3+2*x^2+3*x+6 f =

x^5 + 3*x^4 + 4*x^3 + 2*x^2 + 3*x + 6 >> [f1,m]=simple(subs(f,x,(s-1)/(s+1))) f1 =

19 - (72*s^4 + 120*s^3 + 136*s^2 + 72*s + 16)/(s + 1)^5 m =

simplify(100)

【4】

>> i=0:63; s=sum(2.^sym(i)) s =

18446744073709551615

【5】

>> for i=1:120

if(i==1|i==2) a(i)=1;

else a(i)=a(i-1)+a(i-2);end

if(i==120) a=sym(a); disp(a); end end

[ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025, 20365011074, 32951280099, 53316291173, 86267571272, 139583862445, 225851433717, 365435296162, 591286729879, 956722026041, 1548008755920, 2504730781961, 4052739537881, 6557470319842, 10610209857723, 17167680177565, 27777890035288, 44945570212853, 72723460248141, 117669030460994, 190392490709135, 308061521170129, 498454011879264, 806515533049393, 1304969544928657, 2111485077978050, 3416454622906707, 5527939700884757, 8944394323791464, 14472334024676221, 23416728348467685, 37889062373143906, 61305790721611591, 99194853094755497, 160500643816367088, 259695496911122585, 420196140727489673, 679891637638612258, 1100087778366101931, 1779979416004714189, 2880067194370816120, 4660046610375530309, 7540113804746346429, 12200160415121876738, 19740274219868223167, 31940434634990099905, 51680708854858323072, 83621143489848422977, 135301852344706746049, 218922995834555169026, 354224848179261915075, 573147844013817084101, 927372692193078999176, 1500520536206896083277, 2427893228399975082453, 3928413764606871165730, 6356306993006846248183, 10284720757613717413913, 16641027750620563662096, 26925748508234281076009, 43566776258854844738105, 70492524767089125814114, 114059301025943970552219, 184551825793033096366333, 298611126818977066918552, 483162952612010163284885, 781774079430987230203437, 1264937032042997393488322, 2046711111473984623691759, 3311648143516982017180081, 5358359254990966640871840]

8

【6】 >> k=1;

for i=2:1000 for j=2:i

if rem(i,j)==0

if j

if j==i, A(k)=i; k=k+1; break; end end end end disp(A);

Columns 1 through 13

2 3 5 7 11 13 17 19 23 29 31 Columns 14 through 26

43 47 53 59 61 67 71 73 79 83 89 Columns 27 through 39

103 107 109 113 127 131 137 139 149 151 157 Columns 40 through 52

173 179 181 191 193 197 199 211 223 227 229 Columns 53 through 65

241 251 257 263 269 271 277 281 283 293 307 Columns 66 through 78

317 331 337 347 349 353 359 367 373 379 383 Columns 79 through 91

401 409 419 421 431 433 439 443 449 457 461 Columns 92 through 104

479 487 491 499 503 509 521 523 541 547 557 Columns 105 through 117

571 577 587 593 599 601 607 613 617 619 631 Columns 118 through 130

647 653 659 661 673 677 683 691 701 709 719 Columns 131 through 143

739 743 751 757 761 769 773 787 797 809 811 Columns 144 through 156

827 829 839 853 857 859 863 877 881 883 887 Columns 157 through 168

919 929 937 941 947 953 967 971 977 983 991

【7】

说明:h和D在MATLAB中均应赋值,否则将无法实现相应的分段函数功能 syms x; h=input(‘h=’); D=input(‘D=’); y=h.*(x>D)+(h.*x/D).*(abs(x)<=D)-h.*(x<-D)

9

37 41 97 101 163 167 233 239 311 313 389 397 463 467 563 569 641 643 727 733 821 823 907 911 997 【10】

function y=fib(k)

if nargin~=1,error('出错:输入变量个数过多,输入变量个数只允许为1!');end if nargout>1,error('出错:输出变量个数过多!');end if k<=0,error('出错:输入序列应为正整数!');end if k==1|k==2,y=1;

else y=fib(k-1)+fib(k-2);end end 【13】

10.80.60.40.20-0.2-0.4-0.6-0.8-1-1-0.510

00.51