Re: [問題] 數值方法求解

看板MATLAB作者 (外派越南工作者)時間10年前 (2015/07/24 21:43), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《qrewasd (shu)》之銘言: : beta=-2 % 2,0,-2 : a=(omega-(beta^2))^0.5 : b=(omega+(beta^2))^0.5 : a*b*(1-cosh(b)*cos(a))+(beta^2)*sinh(b)*sin(a)=0 : 求解 a b omega : 我自己試過 : 結果如下 : Warning: Explicit solution could not be found. : > In solve at 81 : ans = : [ empty sym ] : 請問該如何改寫呢? : 3Q 本題涉及非線性跟根號問題 我是用fsolve 解的 帶入的值影響解是有範圍的 ------------------------------------------ function pttex144(t) global beta format long e beta = t; % beta=-2 % -2, 0, 2 omega = fsolve(@yourfun,1) a=(omega-(beta.^2)).^0.5 b=(omega+(beta.^2)).^0.5 function f = yourfun(x) global beta a=(x-(beta.^2)).^0.5; % d1 b=(x+(beta.^2)).^0.5; % d2 f = a.*b.*(1-cosh(b).*cos(a))+(beta.^2).*sinh(b).*sin(a); ------------------------------------------------------------ 執行結果: >> pttex144(-2) Equation solved. fsolve completed because the vector of function values is near zero as measured by the default value of the function tolerance, and the problem appears regular as measured by the gradient. <stopping criteria details> omega = 3.724123341394964e-03 + 1.772674751964346e-13i a = 4.451065079099797e-14 + 1.999068752359109e+00i b = 2.000930814231565e+00 + 4.429625300775632e-14i -- 1.MATLAB programming 2.ASPEN process simulation package 3.FORTRN programming 4.Advance Engineering Mathematics 5.Process Control Theory 6.Chemical Engineering Basic Theory(Kinetic.thermodynamics.transport) 7.Numerical Method and Analysis 8.MATLAB Toolbox.Simulink system basic design -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.233.114.68 ※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1437745423.A.756.html
文章代碼(AID): #1Lia4FTM (MATLAB)
討論串 (同標題文章)
文章代碼(AID): #1Lia4FTM (MATLAB)