matlab打印资料 - 百度文库

ʱ : matlab打印资料 - 百度文库ϿʼĶ

A

?3x?4y?7z?12w?4?5x?7y?4z?2w?4?1.̵Ľ?

x?8z?5w?9????6x?5y?2z?10w?4>> A=[3 4 -7 -12;5 -7 4 2;1 0 8 -5;-6 5 -2 10];

B=[4;4;9;4]; X=A\\B; X

4813??1?543?2???B??6?23?8?

?5?92.A??36???????2?7?12?8????13?97??C1=A*B;C2=A*B;C3=A.*B,з

A=[1 4 8 13;-3 6 -5 -9;2 -7 -12 -8]; B=[5 4 3 -2;6 -2 3 -8;-1 3 -9 7]; C1=A*B' C2=A'*B C3=A.*B inv(C1) inv(C2) inv(C3)

3. y?cosx?0.5???3sinx?x=0~2мΪ101㣬xΪ꣬yΪ2?(1?x)?ߡ

>> x=linspace(0,2*pi,101);

y=cos(x)*(0.5+3*sin(x)/(1+x.^2)); plot(x,y,'g')

4.86׵ֲ̬R1, еƽֵ;þȫƽֵ; randn mean var >> a=randn(8,6) b1=mean(a) b2=var(a)

u=reshape(a,48,1) c1=mean(u) c2=var(u)

5.x=rcost+3t,y=rsint+3,ֱr=2,3,4t=0~10ɵx~yߡ t=0:0.01:10;x1=2*cos(t)+3*t;y1=2*sin(t)+3; x2=3*cos(t)+3*t;y2=3*sin(t)+3; x3=4*cos(t)+3*t;y3=4*sin(t)+3; plot(x1,y1,'g',x2,y2,'r',x3,y3,'b')

6.f(x)=x5- 4x4 +3x2- 2x+ 6

(1) x=[-2,8]֮ȡ100㣬ߣм㡣ʾpolyval

x=linspace(-2,8,100); p=[1 -4 0 3 -2 6]; y=polyval(p,x); plot(x,y,'g')

(2) roots˶ʽĸ p=[1 -4 0 3 -2 6]; roots(p)

7.һַȻԸ´

A='YANG12yi34HONG';

(1) ȡ15ַɵַ

subch=A(1:5)

(2) ַС

revch=A(end:-1:1)

(3) ͳַСдĸĸ

x=find(A>='a'&A<='z')

8.ðlimit÷Լд֤޵ӡ limit(y,x,o,right) Examples:

syms x;limit(sin(x)/x)

syms x;limit(1/x,x,0,'right')

B

1.x=sint, y=sin(nt+a)

(1) a=1n =1,2,3,4,ĸͼзֱ𻭳ߡ >> t=0:pi/100:2*pi; x=sin(t);

y1=sin(t+1);y2=sin(2*t+1);y3=sin(3*t+1);y4=sin(4*t+1); subplot(4,1,1);plot(x,y1,'b'); subplot(4,1,2);plot(x,y2,'g'); subplot(4,1,3);plot(x,y3,'r'); subplot(4,1,4);plot(x,y4,'y');

(2) n=2,ȡa=0/3/2Уĸͼзֱ𻭳ߡ >> t=0:pi/100:2*pi; x=sin(t);

y1=sin(2*t);y2=sin(2*t+pi/3);y3=sin(2*t+pi/2);y4=sin(2*t+pi); subplot(1,4,1);plot(x,y1,'b'); subplot(1,4,2);plot(x,y2,'g'); subplot(1,4,3);plot(x,y3,'r'); subplot(1,4,4);plot(x,y4,'y'); 2z?xe

2?(x2?y2)ڶx=[-2,2],y=[-2,2]ڵ档meshgrid

>> x=-2:.0.05:2;y=-x; [X,Y]=meshgrid(x,y);

Z= (X.^2).* exp(-X.^2 - Y.^2); mesh(X,Y,Z) ;

33x5+4x4+7x3+2x2+9x+12=0иroots >> p=[3 4 7 2 9 12];roots(p)

41ηȫ(ʾx5-1=0) >> p=[1 0 0 0 0 -1];roots(p)

?(?x2?4x?3)/2?3?x??1?5.y????3,3?ϵߡ ?x2?1?1?x?1?(?x2?4x?3)/21?x?3?>> x1=-3:.1:-1;x2=-1:.1:1;x3=1:.1:3 y1=(-x1.^2-4* x1-3)/2; y2=- x2.^2+1;

y3=(-x3.^2+4*x3-3)/2; plot(x1,y1, x2,y2,x3,y3)

C

1.

,

>> Syms x;y=x*exp(2*x);diff(y,20) 2.

,

>> Syms x;y=sin(x)^4+cos(x)^4;diff(y,10)

3.,

>> Syms x y;z=y^4*sin(x)^4+x^4*cos(y)^4;diff(z,x,1) 4

1?(x2?1)(x2?x)dx

>> Syms x;y=1/((x^2+1)*(x^2+x));int(y) 5

?(9?x2)3x6dx

syms x;y=(sqrt(9-x^2)^3)/x^6;int(y) 6

?21dx x?x3>> Syms x;y=1/(x+x^3);int(y,x,1,2) 7.ĺ:

n?2 ðsymsum ?n2n?1?

>> syms n;symsum((n+2)/2^n,n,1,inf)

(x?y)e?xydxdy8.úintز

>> Syms x y;z=(x+y)*exp(-x*y);Z=int(int(z,x),y)

??9跽̣1x3?cos(a)?02x3?cos(x)?03x3?cos(ax)?0÷㹤亯solveֱxĽ⡣a=0.5룬 xֵ⣬roots ĽбȽϡ

1syms x a;y=x^3+cos(a);solve(y)

syms x a;a=cos(0.5);y=x^3+cos(a);solve(y) p=[1 0 0 cos(0.5)];roots(p)

solveĽй̶ʽroots 2>> syms x;y=x^3+cos(x);solve(y) 3>> syms x a;y=x^3+cos(a*x);solve(y) >>syms x a;y=x^3+cos(0.5*x);solve(y)

10΢̵ַĽ⣺ y'''-y''=xy''(2)=4y'(1)=7y(1)=8 >> dsolve('D3y-D2y=x','D2y(2)=4','Dy(1)=7','y(1)=8')

11. x?zsin3z,y?zcos3z, Ҫz=0~10ڻx,y,zάߡ >>z=0:.1:10;x=z.*sin(3*z);y=z.*cos(3*z);plot3(x,y,z) 12. z?xe2?(x2?y2)x=[-2,2],y=[-2,2]ڵͼ

>> x=-2:.2:2;y=-2:.2:2; [X,Y]=meshgrid(x,y);

Z= X.^2.* exp(-X.^2 - Y.^2);surf(X,Y,Z) >> [X,Y] = meshgrid(-2:.2:2, -2:.2:2); Z = X.^2 .* exp(-X.^2 - Y.^2); surf(X,Y,Z)

13z=0.05x-0.05y+0.1; z(ƽ)ͼ

>> [X,Y]=meshgrid(x,y);Z=0.05*X-0.05*Y+0.1;surf(X,Y,Z);surfc(X,Y,Z)

D

1д㣺

1ʹһfor/endѭʹsum 1100ĺ function qiuhe2 s=0 n=100 for i=1:n s=s+i end s

2ʹsumʹκfor/endѭ n1100ʱ1/nĺ function qiuhe

ϵͬͷxxxxx#qq.com(#滻Ϊ@)