Re: [問題] 請益解多變數函數最佳解_function數目ꐠ…已回收

看板MATLAB作者 (幫解MATLAB難題囧)時間16年前 (2009/06/24 18:57), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/3 (看更多)
※ 引述《papajo (歐辜)》之銘言: : 如題 : : function有三個變數 , 如果方程式大於三個的話查了一下精華區 , 好像可以用 fsolve : 這個指令解出來 , 但我解出之後 residual一直很大 , 他請我重設一個初始值 : 我不太清楚是我的程式寫錯了 , 還是我ㄧ開始無法確定初值的大概位子 : 想請教板上的前輩 : 程式碼 : : function f=cvfind(x) : data=load('02.txt'); : real=data(:,1); : rp=data(:,2); : w=data(:,3); : for k=1:1:length(real) : f(k)=x(1)+rp(k)*(1+x(2)^2+w(k)*x(3)*rp(k)*x(2))/(1+(w(k)*x(3)*rp(k)+x(2))^2)-real(k); : end : ------------------------ : x0=[0 0 3.8197*10^-12]; : options=optimset('Display','iter'); : [x,fval] = fsolve(@cvfind,x0,options); : -------------------------------------------- : 執行結果 : : Directional : Iteration Func-count Residual Step-size derivative : 0 4 4.7068e+014 : 1 24 4.70612e+014 6.03e-008 -1.58e+015 : Conditioning of Gradient Poor - Switching To LM method : 2 43 4.69967e+014 1.46e-008 -5.08e+015 7.80318e+021 : 3 60 2.00513e+014 5.26e-008 2.56e+017 3.82274e+022 : 4 61 4.70722e+014 1 -3.94e+014 4.19678e+022 : Optimizer appears to be converging to a minimum that is not a root: : Sum of squares of the function values is > sqrt(options.TolFun). : Try again with a new starting point. : 謝謝~!! 程式碼寄到信箱 資料也請一併寄來 或許可以幫到你 -- Basic -> Advance -> Master -> Expert -> Great-Master Skill: AspenPlus AspenDynamic MATLAB Numerical-Method Level: Master Advance Expert Master -----------......什麼時候升級呢? 囧> -------------- Fortran Tecplot Sigmaplot Corldraw Basic Basic Basic Basic -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.43.41.224
文章代碼(AID): #1AGWQ8Rq (MATLAB)
文章代碼(AID): #1AGWQ8Rq (MATLAB)