matlabϰÌâ

ezplot('(cos(x))^(1/2)',[-pi/2 pi/2]); ylabel('y'); subplot(2,2,3); x=-2:0.5:2; y=-4:1:4;

ezsurfc('x^2/2^2+y^2/4^2')

(cos(x))1/210.5y0-1x2/22+y2/420x1105050y-5-5x05

»ù±¾±à³ÌÌ⣨ÿСÌâ10·Ö£¬¹²30·Ö£©

1. Write a program to compute the following expressions

;

Here, we suppose the variable x has existed in the workspace. for i=1:10 for j=1:10

xbar(i)=xbar(i)+x(i,j); end

xbar(i)=xbar(i)/10; end

for i=1:10 for j=1:10

t1=0;t2=0;t3=0; for k=1:3

t1=t1+(x(i,k)-xbar(i))*(x(j,k)-xbar(j)); t2=t2+(x(i,k)-xbar(i))^2; t3=t3+(x(j,k)-xbar(j))^2; end

r2(i,j)=t1/sqrt(t2*t3); end end r2

2. (1) Using plot() function to plot the curves of

and

in the range of , let their color are red and green respectively, and add the grid to the figure.

(2) Using fplot() function and ezplot() function to plot above-mentioned (ÉÏÊöµÄ) curves respectively. (1)x=-2*pi:pi/100:2*pi;

y=(sin(2*x)+cos(3*x)).*exp(-2*x); z=sin(x)/x;

plot(x,y,¡¯r¡¯,x,z,¡¯g¡¯)

£¨2£©fplot('[(sin(2*x)+cos(3*x)).*exp(-2*x), sin(x)/x]',[-2*pi 2*pi]) 3. Plot the 3D mesh figure and 3D surface figure of the function in the range of and , respectively. x=-4:1/100:4; y=-4:1/100:4;

z=9(1-x)^2*exp(-x¡¯^2/2-(y¡¯+1)^2) mesh(x,y,z); surf(x,y,z);

д³ö³ÌÐòµÄÖ´Ðнá¹û»òд³ö¸ø¶¨ÒªÇóµÄÖ¸Á×ܹ²35·Ö£© 1. д³öÖ´ÐÐÒÔÏ´úÂëºóC£¬D£¬EµÄÖµ (6·Ö) A=[1,2,3;4:6;7:9]; C=[A;[10,11,12]], D=C(1:3,[2 3]) E=C(2,[1 2]) C =

1 2 3 4 5 6 7 8 9 10 11 12

D =

2 3 5 6 8 9 E =

4 5

2. д³öÖ´ÐÐÒÔÏ´úÂëºó£¬MATLABÃüÁî´°¿ÚÉÏÏÔʾµÄx¾ØÕóµÄÖµ (5·Ö) x=[0,1,0,2,0,3,0,4]; for k=1:8 if x(k)==0 x(k)=k; else

x(k)=2*k+1; end end disp(x);

1 5 3 9 5 13 7 17

3. ´´½¨·ûºÅº¯Êý²¢Çó½â£¬ÒªÇóд³ö²½ÖèºÍÔËÐнá¹û£¨7·Ö£© (1)´´½¨·ûºÅº¯Êýf=ax2+bx+c (2)Çóf=0µÄ½â syms a x b c; f=a*x^2+b*x+c; solve(f) ans =

1/2/a*(-b+(b^2-4*a*c)^(1/2)) 1/2/a*(-b-(b^2-4*a*c)^(1/2))

4. Çó½âÒÔÏÂÏßÐÔ·½³Ì×飬ҪÇóд³ö³ÌÐò´úÂëºÍÔËÐнá¹û£¨5·Ö£© 2x1-3x2+x3+2x4=8

x1+3x2+ x4=6 x1-x2+x3+8x4=1 7x1+x2-2x3+2x4=5

½â£º³ÌÐò´úÂ룺a=[2 -3 1 2;1 3 0 1;1 -1 1 8;7 1 -2 2]; b=[8 6 1 5]'; ra=rank(a); rb=rank([a b]); det(a); xx=a\\b

5£®»æÖƺ¯ÊýÇúÏߣ¬ÒªÇóд³ö³ÌÐò´úÂë(12·Ö) (1)ÔÚÇø¼ä[0:2¦Ð]¾ùÔȵÄÈ¡50¸öµã£¬¹¹³ÉÏòÁ¿¦Ð

(2)ÔÚͬһ´°¿Ú»æÖÆÇúÏßy1=sin(2*t-0.3); y2=3cos(t+0.5)£»ÒªÇóy1ÇúÏßΪºìÉ«µã»®Ïߣ¬±ê¼ÇµãΪԲȦ£»y2ΪÀ¶É«ÐéÏߣ¬±ê¼ÇµãΪÐǺš£ ½â£º´úÂëÈçÏ£ºt=linspace(0,2*pi,50); plot(t,sin(2*t-0.3),'r-.o'); hold on;

plot(t,3*cos(t+0.5),'b--*')

6. ´òÓ¡³öËùÓеÄË®ÏÉ»¨Êý¡£Ëùν¡°Ë®ÏÉ»¨Êý¡±£¬ÊÇÖ¸Ò»¸öÈýλÊý£¬Æä¸÷λÊý×ÖÁ¢·½Ö®ºÍµÈÓÚ¸ÃÊý±¾Éí¡£ ½â£º³ÌÐòÈçÏ£º for k=100:999 a=fix(k/100);

b=rem(fix(k/100),10); c=rem(k,10);

if a.^3+b.^3+c.^3==k fprintf('%u,\\t\\t',k); end end

´ð°¸ÈçÏ£º 397, 713,

10. ÓÉÖ¸ÁîA=rand(3,5)Éú³É¶þάÊý×éA£¬ÊÔÇó¸ÃÊý×éÖÐËùÓдóÓÚ0.5µÄÔªËØµÄλÖ㬷ֱðÇó³öËüÃǵġ°È«Ï±ꡱºÍ¡°µ¥Ï±ꡱ¡£

ÁªÏµ¿Í·þ£º779662525#qq.com(#Ìæ»»Îª@)