資源描述:
《第三講MATLAB的符號(hào)運(yùn)算.doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、個(gè)人收集整理勿做商業(yè)用途第三講MATLAB的符號(hào)運(yùn)算--matlab不僅具有數(shù)值運(yùn)算功能,還開(kāi)發(fā)了在matlab環(huán)境下實(shí)現(xiàn)符號(hào)計(jì)算的工具包SymbolicMathToolbox符號(hào)運(yùn)算的功能?符號(hào)表達(dá)式、符號(hào)矩陣的創(chuàng)建?符號(hào)線性代數(shù)?因式分解、展開(kāi)和簡(jiǎn)化?符號(hào)代數(shù)方程求解?符號(hào)微積分?符號(hào)微分方程一、創(chuàng)建符號(hào)變量1.什么是符號(hào)運(yùn)算?與數(shù)值運(yùn)算的區(qū)別※數(shù)值運(yùn)算中必須先對(duì)變量賦值,然后才能參與運(yùn)算。 ※符號(hào)運(yùn)算無(wú)須事先對(duì)獨(dú)立變量賦值,運(yùn)算結(jié)果以標(biāo)準(zhǔn)的符號(hào)形式表達(dá)。?特點(diǎn):①運(yùn)算對(duì)象可以是沒(méi)賦值的符號(hào)變量②可以獲得任意精度的解?SymbolicMathToolbox——符號(hào)運(yùn)算工具包通過(guò)調(diào)用Ma
2、ple軟件實(shí)現(xiàn)符號(hào)計(jì)算的.?maple軟件--主要功能是符號(hào)運(yùn)算,它占據(jù)符號(hào)軟件的主導(dǎo)地位。2。Sym函數(shù)定義符號(hào)變量(1)S=sym(arg)Constructsymbolicnumbers,variablesandobjects。S=SYM(A)constructsanobjectS,ofclass’sym',fromA.Iftheinputargumentisastring,theresultisasymbolicnumberorvariable。Iftheinputargumentisanumericscalarormatrix,theresultisasymbolicrepres
3、entationofthegivennumericvaluesx=sym(’x')createsthesymbolicvariablewithname'x’andstorestheresultinx.x=sym(’x’,’real')alsoassumesthatxisreal,sothatconj(x)isequaltox。alpha=sym('alpha')andr=sym('Rho‘,'real')areotherexamples.Similarly,k=sym(’k’,’positive’)makeskapositive(real)variable。x=sym('x’,’unrea
4、l')makesxapurelyformalvariablewithnoadditionalproperties(i.e。,insuresthatxisNEITHERrealNORpositive).Seealso:SYMS.Statementslikepi=sym('pi’)anddelta=sym('1/10')createsymbolicnumberswhichavoidthefloatingpointapproximationsinherentinthevaluesofpiand1/10。Thepicreatedinthiswaytemporarilyreplacesthebuil
5、t-innumericfunctionwiththesamename.S=sym(A,flag)convertsanumericscalarormatrixtosymbolicform。Thetechniqueforconvertingfloatingpointnumbersisspecifiedbytheoptionalsecondargument,whichmaybe'f’,’r',’e’or’d’.Thedefaultis'r'.’f'standsfor'floatingpoint’。Allvaluesarerepresentedintheform’1。F’*2^(e)or’-1.F
6、’*2^(e)whereFisastringof13hexadecimaldigitsandeisaninteger。Thiscapturesthe個(gè)人收集整理勿做商業(yè)用途floatingpointvaluesexactly,butmaynotbeconvenientforsubsequentmanipulation。Forexample,sym(1/10,’f')is'1.999999999999a’*2^(-4)because1/10cannotberepresentedexactlyinfloatingpoint.'r'standsfor’rational’.Floatingpoin
7、tnumbersobtainedbyevaluatingexpressionsoftheformp/q,p*pi/q,sqrt(p),2^qand10^qformodestsizedintegerspandqareconvertedtothecorrespondingsymbolicform。Thiseffectivelycompensatesfortheroundofferrorinvolvedintheorigina