¿Î³ÌÉè¼ÆÃû³Æ£º Éè¼Æ¶þ£ºÊý¾ÝÄâºÏ Ö¸µ¼½Ìʦ£º ÕÅÀò ¿Î³ÌÉè¼ÆʱÊý£º 6 ¿Î³ÌÉè¼ÆÉ豸£º°²×°ÁËMatlab¡¢C++Èí¼þµÄ¼ÆËã»ú ¿Î³ÌÉè¼ÆÈÕÆÚ£º ʵÑéµØµã£º µÚÎå½Ìѧ¥±±902 ¿Î³ÌÉè¼ÆÄ¿µÄ£º
1. Á˽â×îС¶þ³ËÄâºÏµÄÔÀí£¬ÕÆÎÕÓÃMATLAB×÷×îС¶þ³ËÄâºÏµÄ·½·¨£» 2. ѧ»áÀûÓÃÇúÏßÄâºÏµÄ·½·¨½¨Á¢ÊýѧģÐÍ¡£
¿Î³ÌÉè¼Æ×¼±¸£º
1. ÔÚ¿ªÊ¼±¾ÊµÑé֮ǰ£¬Çë»Ø¹ËÏà¹ØÄÚÈÝ£»
2. ÐèҪһ̨׼±¸°²×°Windows XP Professional²Ù×÷ϵͳºÍ×°ÓÐÊýѧÈí¼þµÄ¼ÆËã»ú¡£
¿Î³ÌÉè¼ÆÄÚÈݼ°ÒªÇó
ÒªÇó£ºÉè¼Æ¹ý³Ì±ØÐë°üÀ¨ÎÊÌâµÄ¼òÒªÐðÊö¡¢ÎÊÌâ·ÖÎö¡¢ÊµÑé³ÌÐò¼°×¢ÊÍ¡¢ÊµÑéÊý¾Ý¼°½á¹û·ÖÎöºÍʵÑé½á
ÂÛ¼¸¸öÖ÷Òª²¿·Ö¡£
1. ÓÃÇÐÏ÷»ú´²½øÐнðÊôÆ·¼Ó¹¤Ê±£¬ÎªÁËÊʵ±µØµ÷Õû»ú´²£¬ÐèÒª²â¶¨µ¶¾ßµÄÄ¥ËðËٶȣ¬ÔÚÒ»¶¨µÄʱ¼ä²âÁ¿µ¶¾ßµÄºñ¶È£¬µÃÊý¾ÝÈç±íËùʾ£¬ÇëÑ¡ÓúÏÊʵĺ¯ÊýÀ´ÃèÊöÇÐÏ÷ʱ¼äÓ뵶¾ßºñ¶ÈµÄ¹Øϵ¡£ ÇÐÏ÷ʱ¼ät/h 0 1 29.1 9 26.8 2 29.8 10 26.5 3 28.1 11 26.3 4 28.0 12 26.1 5 27.7 13 25.7 6 27.5 14 25.3 7 27.2 15 24.8 µ¶¾ßºñ¶Èy/cm 30.0 ÇÐÏ÷ʱ¼ät/h 8 µ¶¾ßºñ¶Èy/cm 27.0
Ê×Ïȱà¼Ò»¸öMÎļþ£¬³ÌÐòÈçÏ£º
t=0:15;
y=[30.0 29.1 29.8 28.1 28.0 27.7 27.5 27.2 27.0 26.8 26.5 26.3 26.1 25.7 25.3 24.8]; A=polyfit(t,y,3); %A±íʾÎÒËùÄâºÏ³öµÄ·½³ÌµÄϵÊý
h=polyval(A,t); %h±íʾÄâºÏ³öµÄ·½³ÌËùÒªÇó½â³öµÄδ֪Êý£¬±¾ÌâÖм´ÊÇyµÄÖµ
plot(t,y,'*r',t,h,'k')%Ç°ÃæÊÇÓÃÒÑÖªÊý¾ÝÃèµÄµã£¬ºóÃæµÄÊÇÓÃÊý¾ÝÄâºÏ×ö³öµÄÏߣ¬×öÔÚÒ»Æð¿ÉÒԶԱȿ´Ð§¹û s=abs(y-h);%ÇóÎó²îµÄ¾ø¶ÔÖµ s=sum(s); %ÇóÎó²îµÄ¾ø¶ÔÖµÖ®ºÍ A=sum(abs(h));%ÇóÄâºÏµÄ¾ø¶ÔÖµÖ®ºÍ F=s/A*100 %ÇóÏà¶ÔÎó²î
3´ÎÇúÏßÄâºÏ³öµÄÏà¶ÔÎó²îÏà¶Ô½ÏС£¬ËùÒÔÎÒÑ¡ÔñÁËÈý´ÎÄâºÏ£ºÄâºÏÇúÏßͼÏñÈçÏÂ
3130292827262524051015
2. MalthusÈË¿ÚÖ¸ÊýÔö³¤Ä£ÐÍ Äê ÈË¿Ú£¨ÒÚ£© Äê ÈË¿Ú£¨ÒÚ£© Äê ÈË¿Ú£¨ÒÚ£© 1790 3.9 1870 38.6 1950 150.7 1800 5.3 1880 50.2 1960 179.3 1810 7.2 1890 62.9 1970 204.0 1820 9.6 1900 76.0 1980 226.5 1830 12.9 1910 92.0 1990 251.4 1840 17.1 1920 106.5 2000 281.4 1850 23.2 1930 123.2 1860 31.4 1940 131.7 ÓÃÒÔÉÏÊý¾Ý¼ìÑéÂí¶ûÈø˹ÈË¿ÚÖ¸ÊýÔö³¤Ä£ÐÍ£¬¸ù¾Ý¼ìÑé½á¹û½øÒ»²½ÌÖÂÛÂí¶ûÈø˹ÈË¿ÚÄ£Ð͵ĸĽø¡£ ÒòΪÒÑÖª¸ÃÇøÈË¿Ú³ÊÖ¸ÊýÔö³¤£¬ËùÒÔÓÃÖ¸ÊýÄâºÏ,³ÌÐò±àдÈçÏ£º
t= 1790:10:2000;
y=[3.9 5.3 7.2 9.6 12.9 17.1 23.2 31.4 38.6 50.2 62.9 76.0 92.0 106.5 123.2 131.7 150.7 179.3 204.0 226.5 251.4 281.4];
p=polyfit(t,log(y),1); %ÓÃÒ»´Î¶àÏîʽÄâºÏyµÄ¶ÔÊý m=p(1) %¼ÆËãÖ¸Êý²ÎÊýÖµ y0=exp(p(2)) %¼ÆË㺯ÊýϵÊý
y1=y0.*exp(m.*t); %ÈË¿ÚÔö³¤º¯Êý±í´ïʽ plot(t,y,'k+',t,y1,'b') ³ÌÐòÔËÐнá¹ûΪ£º
m =
0.0202 y0 =
1.1565e-015
ͼÐÎΪ£º
450400350300250200150100500175018001850190019502000
3£®¼Û¸ñÔ¤²â
ÃÀ¹ú¾É³µ¼Û¸ñµÄµ÷²éÊý¾Ý
xi 1 2615 2 1943 3 1494 4 1087 5 765 6 538 7 484 8 290 9 226 10 204 yi ·ÖÎöÓÃʲôÐÎʽµÄÇúÏßÀ´ÄâºÏÊý¾Ý£¬²¢Ô¤²âʹÓÃ4¡¢5ÄêºóµÄ¾É³µÆ½¾ù¼Û¸ñ´óÖÂΪ¶àÉÙ¡£ ¾É³µ¼Û¸ñ³Ê·ÇÏßÐÔϽµÇ÷ÊÆ£¬ÓÉÓÚÊý¾Ý½ÏÉÙ£¬¿ÉÒÔ×öÏßÐÔÄâºÏ£º Ê×Ïȱà¼Ò»¸öMÎļþ£¬³ÌÐòÈçÏ£º
t=1:10;
y=[2615 1943 1494 1087 765 538 484 290 226 204]; A=polyfit(t,y,3) %A±íʾÎÒËùÄâºÏ³öµÄ·½³ÌµÄϵÊý
y1=polyval(A,t); %±íʾÄâºÏ³öµÄ·½³ÌËùÒªÇó½â³öµÄδ֪Êý£¬±¾ÌâÖм´ÊÇyµÄÖµ£¬Õâ¸öËãʽ±íʾÄâºÏ·½³Ì plot(t,y,'*r',t,y1,'k')%Ç°ÃæÊÇÓÃÒÑÖªÊý¾ÝÃèµÄµã£¬ºóÃæµÄÊÇÓÃÊý¾ÝÄâºÏ×ö³öµÄÏߣ¬×öÔÚÒ»Æð¿ÉÒԶԱȿ´Ð§¹û
s=sum(abs(y-y1));%ÇóÎó²îµÄ¾ø¶ÔÖµÖ®ºÍ k=sum(abs(y1));%ÇóÄâºÏµÄ¾ø¶ÔÖµÖ®ºÍ F=s/k*100 %ÇóÏà¶ÔÎó²î
³ÌÐòÔËÐнá¹ûΪ£º
A = %Õâ¸öÊÇÄâºÏº¯ÊýµÄϵÊý 1.0e+003 *
-0.0027 0.0800 -0.8528 3.3801
F = %ÕâÊÇÈý´ÎÄâºÏº¯ÊýµÄÎó²îΪ°Ù·ÖÖ®2.5365 2.5365
30002500200015001000500012345678910
¸ù¾ÝÄâºÏϵÊý¿ÉÒÔд³öÄâºÏº¯ÊýΪ£ºy??2.7x?80x?852.8x?3380.1 ÔÙ±à¼Ò»¸öC++³ÌÐò¼´¿ÉÇó³ö4,5ÄêºóµÄ¾É³µ¼Û¸ñ£¬³ÌÐòÈçÏ£º #include
int x1=4,x2=5;
32
double y1,y2;
y1=-2.7*x1*x1*x1+80*x1*x1-852.8*x1+3380.1;
y2=-2.7*x2*x2*x2+80*x2*x2-852.8*x2+3380.1; }
cout<<\cout<<\return 0;
4£®ÓÃ×îС¶þ³Ë·¨ÇóÒ»¸öÐÎÈçy?a?bxµÄ¾Ñ鹫ʽ£¬Êý¾ÝÈçÏ£º
2x y 19 19.0 25 32.3 31 49.0 38 73.3 44 98.8 Ê×Ïȱà¼Ò»¸öMÎļþ£¬³ÌÐòÈçÏ£º
x=[19 25 31 38 44];
y=[19.0 32.3 49.0 73.3 98.8];
fun1=inline('c(1)+c(2)*x.^2','c','x'); %ÓÃinlineº¯ÊýÈ·¶¨ÇúÏßÐÎʽΪy=a+b*x*x,cΪ²ÎÊý£¬xΪϵÊý, c=lsqcurvefit(fun1,[0,0],x,y) %ÓÃlsqcurvefitº¯ÊýÇó³ö´ý¶¨²ÎÊý y1=c(1)+c(2)*x.^2; %ÄâºÏº¯Êý±í´ïʽֵ plot(x,y,'k*',x,y1,'g')
³ÌÐòÔËÐнá¹ûΪ£º c =
0.5937 0.0506
¸ù¾ÝÄâºÏϵÊý¿ÉÒÔд³öÄâºÏº¯ÊýΪ£ºy=0.5937+0.0506*x*x
ÄâºÏÇúÏßΪ£º
10090807060504030201015202530354045