?? ch4_1_1.htm
字號:
<! Made by Html Translation Ver 1.0><html><head><title> 常見數(shù)學(xué)函數(shù) </title></head><body BACKGROUND="../img1/bg0000.gif" tppabs="http://webclass.ncu.edu.tw/~junwu/img/bg0000.gif"><script language="JAVASCRIPT"><!--if (navigator.onLine){document.write("<!-- Spidersoft WebZIP Ad Banner Insert -->");document.write("<TABLE width=100% border=0 cellpadding=0 cellspacing=0>");document.write("<TR>");document.write("<TD>");document.write("<ILAYER id=ad1 visibility=hidden height=60></ILAYER>");document.write("<NOLAYER>");document.write("<IFRAME SRC='http://www.spidersoft.com/ads/bwz468_60.htm' width=100% height=60 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no></IFRAME>");document.write("</NOLAYER>");document.write("</TD>");document.write("</TR>");document.write("</TABLE>");document.write("<!-- End of Spidersoft WebZIP Ad Banner Insert-->");} //--></script><!-- Spidersoft WebZIP Ad Banner Insert --><!-- End of Spidersoft WebZIP Ad Banner Insert--><font COLOR="#0000FF"><h1>4.1.1 常見數(shù)學(xué)函數(shù)</h1></font><hr><p>我們在第二章已介紹了加、減、乘、除等簡易的代數(shù)運算,除此之外MATLAB還提供許多內(nèi)建函數(shù),如對數(shù) 函數(shù)、三角函數(shù)、多項式函數(shù)等,方便我們計算。舉例來說,要計算一角度的sine值,過程如下: </p><p><font COLOR="#FF0000">>> angle1=pi/2;</font> </p><p><font COLOR="#FF0000">>> b=sin(angle1); %注意angle1為徑度,sin函數(shù)計算值需以徑度表示</font> </p><p><font COLOR="#FF0000">>> angle2=90; %注意angle2為角度</font> </p><p><font COLOR="#FF0000">>> b=sin(angle2*pi/180); %也可在函數(shù)內(nèi)作角度與徑度轉(zhuǎn)換 </font></p><p><font COLOR="#FF0000">>> x=sqrt(2)/2; y=asin(x); y_deg=y*180/pi</font> </p><p><font COLOR="#FF0000">>> x =</font> </p><p><font COLOR="#FF0000">0.7071</font> </p><p><font COLOR="#FF0000">>> y =</font> </p><p><font COLOR="#FF0000">0.7854</font> </p><p><font COLOR="#FF0000">>> y_deg =</font> </p><p><font COLOR="#FF0000">45.0000<br></font></p><p>使用函數(shù)須注意幾點。首先函數(shù)一定出現(xiàn)在計算等式的右邊,等式左邊是代表這個函數(shù)的計算值。此外,一 個函數(shù)可以被當(dāng)做另一個函數(shù)的引數(shù)(argument)。例如:<font COLOR="#FF0000">log_x=log(abs(x))</font>其中<font COLOR="#FF0000">abs</font>和<font COLOR="#FF0000">log</font>皆為內(nèi)建函數(shù),其意思是 先計算abs(x),所得值再代入log函數(shù)。 <br></p><p>指令 意義 </p><p><font COLOR="#FF0000">round(x)</font> 將<font COLOR="#FF0000">x</font>值進(jìn)位至最接近的整數(shù) </p><p><font COLOR="#FF0000">fix(x)</font> 將<font COLOR="#FF0000">x</font>值進(jìn)位至最接近0的整數(shù) </p><p><font COLOR="#FF0000">floor(x)</font> 將<font COLOR="#FF0000">x</font>值進(jìn)位至最接近<font SIZE="5">-</font>∞的整數(shù) </p><p><font COLOR="#FF0000">ceil(x)</font> 將<font COLOR="#FF0000">x</font>值進(jìn)位至最接近∞的整數(shù) </p><p><font COLOR="#FF0000">sign(x)</font> 如果<font COLOR="#FF0000">x</font> <0傳回值為-1,如果<font COLOR="#FF0000">x</font> =0傳回值為0,如果<font COLOR="#FF0000">x</font> >0傳回值為 1 </p><p><font COLOR="#FF0000">rem(x,y)</font> 傳回x/y的余數(shù),例如<font COLOR="#FF0000">rem(25,4)</font>的值為1 </p><p><font COLOR="#FF0000">exp(x)</font> 指數(shù)函數(shù) </p><p><font COLOR="#FF0000">log(x)</font> 以e <font FACE="細(xì)明體">2.718282</font>為底的對數(shù)函數(shù),及自然對數(shù) </p><p><font COLOR="#FF0000">log10(x)</font> 為10底的對數(shù)函數(shù)<br></p><p>其余的內(nèi)建函數(shù),用法可以參考MATLAB的線上說明或使用手冊。<br></p><hr><a HREF="../../../../tppmsgs/msgs0.htm#90" tppabs="http://webclass.ncu.edu.tw/~junwu/ch4_1.htm"><p><img SRC="../img1/lastpage.gif" tppabs="http://webclass.ncu.edu.tw/~junwu/img/lastpage.gif" BORDER="0" WIDTH="42" HEIGHT="42"></a> <a tppabs="http://webclass.ncu.edu.tw/~junwu/ch4_1_2.htm" href="ch4_1_2.htm"><img SRC="../img1/nextpage.gif" tppabs="http://webclass.ncu.edu.tw/~junwu/img/nextpage.gif" BORDER="0" HSPACE="10" WIDTH="42" HEIGHT="42"></a> <a HREF="../index.html" tppabs="http://webclass.ncu.edu.tw/~junwu/index.html"><img SRC="../img1/outline.gif" tppabs="http://webclass.ncu.edu.tw/~junwu/img/outline.gif" BORDER="0" HSPACE="6" WIDTH="42" HEIGHT="42"></a><br><font SIZE="2" COLOR="#AA55FF">上一頁 下一頁 講義大綱 </font><layer src="http://www.spidersoft.com/ads/bwz468_60.htm" visibility="hidden" id="a1" width="600" onload="moveToAbsolute(ad1.pageX,ad1.pageY); a1.clip.height=60;visibility='show';"></layer> </p></body></html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -