用matlab解非線性方程組

來源:互聯網
上載者:User

    使用matlab的fsolve函數,首先需要寫一個m檔案來描述非線性方程組,比如

function eq=nxxf(x)

global number;

number=number+1

eq(1) = x(1)*normcdf(x(3),0,1)-80120231*normcdf(x(4),0,1)*exp(-0.02)-595042771.7;

eq(2) = (log(x(1)/80120231)+0.02+0.5*(x(2)^2))/x(2)-x(3);

eq(3) = x(3)-x(2)-x(4);

eq(4) = (normcdf(x(3),0,1)*x(1)*x(2))/595042771.7-0.0475;

其中每個方程都是移項後一邊為0後,另外一邊的式子。然後在matlab命令視窗輸入global number;number=0;y=fsolve('nxxf',[1,1,1,1])number其中fsolve函數第一個參數就是非線性方程組的函數,第二個是初始點,將輸出結果和迭代步數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.