Re: [問題] 請教多元多次聯立方程式求矛盾解之問題已回收

看板MATLAB作者 (MATLAB程式編輯員)時間16年前 (2010/06/12 17:11), 編輯推噓1(101)
留言2則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《kingofcowb (king of cowb)》之銘言: : 大家好 : 有一個關於解方程式的問題想要問一下板上的高手 : 若假設有未知數x1,x2,x3,x4,x5,x6 : 以及已知常數c1,c2,c3,c4,c4,c5,c6,c7,c8,c9,c10 : 則可以得到聯立方程式 : c1=(x1*x2-2*x5)/x6 : c2=2*x4/(x3*x5) : c3=(x2^2-x6)/x1 : c4=(x1*x3^2-x6)/x5 : c5=x2*x3-x5 : c6=x3-x2/x6 : c7=x1-x2*x4 : c8=x6-x1 : c9=x2-x4^2*x5 : c10=x1^2-x3 : 若要求解矛盾方程式解 : 應該要用哪一個function? : 我有試用過lsqnonlin、fslove這兩個function : 但是都不得其門而入 : 希望板上高手能夠幫幫忙 : 多謝 可以用fsolve解.但會隨著你的常數的不同 與起始猜值的不同而會解到不同的結果 -----------------------程式------------------- function pttex138 h = fsolve(@xyzr,[1 1 1 1 1 1]) function f = xyzr(x) c1 = 1;c2 = 2;c3 = 3; c4 = 4;c5 = 5;c6 = 6; c7 = 7;c8 = 8;c9 = 9; c10 = 10; f = zeros(10,1); f(1) = (x(1).*x(2)-2.*x(5))./x(6)-c1; f(2) = 2.*x(4)./(x(3).*x(5))-c2; f(3) = (x(2).^2-x(6))./x(1)-c3; f(4) = (x(1).*x(3).^2-x(6))./x(5)-c4; f(5) = x(2).*x(3)-x(5)-c5; f(6) = x(3)-x(2)./x(6)-c6; f(7) = x(1)-x(2).*x(4)-c7; f(8) = x(6)-x(1)-c8; f(9) = x(2)-(x(4).^2).*x(5)-c9; f(10) = x(1).^2-x(3)-c10; ---------------------跑出的結果------------------- Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead. > In fsolve at 324 In pttex138 at 2 Optimizer appears to be converging to a minimum that is not a root: Sum of squares of the function values exceeds the square root of options.TolFun. Try again with a new starting point. h = 3.9327 5.2916 4.7933 -0.0889 19.8976 12.5215 -- 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) ◆ From: 113.160.148.219

06/12 17:26, , 1F
多謝幫忙 我打算自己寫一個GA的演算法是是可不可以找
06/12 17:26, 1F

06/12 17:28, , 2F
到Global的解
06/12 17:28, 2F
文章代碼(AID): #1C4qzNwh (MATLAB)
文章代碼(AID): #1C4qzNwh (MATLAB)