資源描述:
《各章實(shí)驗(yàn)作業(yè)題實(shí)驗(yàn)6作業(yè)題.doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、實(shí)驗(yàn)6作業(yè)題1.求函數(shù)的偏導(dǎo)數(shù).操作:在命令窗口中輸入:>>dz_dx=diff('cos(x*y)','x')顯示dz_dx=-sin(x*y)*y繼續(xù)輸入:>>dz_dy=diff('cos(x*y)','y')顯示:dz_dy=-sin(x*y)*x即,2.計(jì)算函數(shù)的極值.操作:在matlab中依次選擇“FileNewM-File”,在彈出的M文件編輯窗口中在命令窗口中輸入:clearall;clcsymsxy;z=x^3-6*x-y^3+3*y;dz_dx=diff(z,x);%計(jì)算z對(duì)x的偏導(dǎo)數(shù)dz_dy
2、=diff(z,y);%計(jì)算z對(duì)y的偏導(dǎo)數(shù)[x0,y0]=solve(dz_dx,dz_dy);%求駐點(diǎn)x0,y0A_=diff(z,x,2);%計(jì)算z對(duì)x的二階偏導(dǎo)數(shù)B_=diff(diff(z,x),y);%計(jì)算z對(duì)x,y的二階混合偏導(dǎo)數(shù)C_=diff(z,y,2);%計(jì)算z對(duì)y的二階偏導(dǎo)數(shù)x0=double(x0);%數(shù)據(jù)轉(zhuǎn)換y0=double(y0);n=length(x0);%計(jì)算x0中元素的個(gè)數(shù)fori=1:nA_x=subs(A_,x,x0(i));%把x=x0(i)(即x0的第i個(gè)元素值)代入z對(duì)x的二
3、階偏導(dǎo)數(shù)A=subs(A_x,y,y0(i));%繼續(xù)把y=y0(i)(即y0的第i個(gè)元素值)代入z對(duì)x的二階偏導(dǎo)數(shù),得到AB_x=subs(B_,x,x0(i));%把x=x0(i)代入z對(duì)x、y的二階混合偏導(dǎo)數(shù)B=subs(B_x,y,y0(i));%繼續(xù)把y=y0(i)代入二階混合偏導(dǎo)數(shù),得到BC_x=subs(C_,x,x0(i));%把x=x0(i)代入z對(duì)y的二階偏導(dǎo)數(shù)C=subs(C_x,y,y0(i));%繼續(xù)把y=y0(i)代入z對(duì)y的二階偏導(dǎo)數(shù),得到CD=A*C-B^2;text=['原函數(shù)在(',
4、num2str(x0(i)),',',num2str(y0(i)),')處'];ifD>0fm=subs(x^3-6*x-y^3+3*y,{x,y},{x0(i),y0(i)});%求函數(shù)值ifA>0disp([text,'有極小值',num2str(fm)])%在命令窗口中輸出elsedisp([text,'有極大值',num2str(fm)])2endendifD==0disp([text,'的極值情況還不確定,還需另作討論'])endend保存后,選擇M文件編輯窗口中的“Debugrun”,顯示如下結(jié)果:原函數(shù)
5、在(1.4142,-1)處有極小值-7.6569原函數(shù)在(-1.4142,1)處有極大值7.65693.計(jì)算,:頂點(diǎn)分別為,和的三角形閉區(qū)域;操作:在命令窗口中輸入:>>symsxy;S=int(int(2*x-y,y,0,1-x),x,0,1)顯示:S=1/6即:二重積分.2