日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

matlab计算方程fsolve,matlab中关于fsolve解非线性方程组的问题

發布時間:2025/3/21 循环神经网络 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab计算方程fsolve,matlab中关于fsolve解非线性方程组的问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

求E1_mean的程序沒問題,function定義也沒問題,問題出在fsolve。fsolve是為了求每個E1_mean元素對應的x(1),x(2),也就是V和sigmaV,E1_mean包含10000個數據,怎樣才能一次性求出對應的10000對V和sigmaV?? ?matlab為R2013b。程序如下:

globalE1_mean

beta01=zeros(1,10000);beta01(1,: )=0.00000901;beta1=0.93095390;beta2=0.06165110;r=zeros(1,10000);r(1,: )=0.00196230; theta=zeros(1,10000);theta(1,: )=-0.00032120 ;path1=zeros(245,10000);? ? path1(1,: )=0.001218392 ^2;R1=zeros(245,10000);

for i=2:245

path1(i,: )=beta01+beta1*path1(i-1,: )+beta2*path1(i-1,: ).*(randn(1,10000)-theta).^2 ;

R1(i,: )=r+(path1(i,: ).^0.5).*randn(1,10000);

end

R1_cumsum=cumsum(R1,1);

E1=zeros(244,10000);

for i=1:244

E1(i,: )=180970333.4*exp(R1_cumsum(i+1,: ));

end

E1_mean=mean(E1,1);

function F = blsprice(x)

globalE1_mean j

%? ?x(1) : V; 銀行總資產

%? ?x(2) : sigmav; 資產波動率

rf = 3.6/100;? ?? ?%無風險利率

B = 2055510000000.00 /(10^12) ;? ?? ?%股權的執行價格 B/(10^12)

sigmaE = 0.545240875??;

T = 1;? ???% 時間周期

t = 0;? ???% 時間

forj=1:10000

d1 = (log(x(1)/(0.97*B))+rf*(T-t)+x(2)^2*(T-t)/2) / (x(2)*sqrt(T-t));

d2 = d1-x(2)*sqrt(T-t);

F(1) = x(1)* normcdf(d1) - 0.97*B* normcdf(d2) -(E1_mean(1,j))/10^12;

F(2) = x(1)*normcdf(d1)*x(2) - sigmaE*(E1_mean(1,j))/10^12;

end

globalj

V1=zeros(1,10000);

sigmaV1=zeros(1,10000);

forj=1:10000

x0 = [1.2;1];

options=optimset('Display','off','MaxFunEvals',10000,'MaxIter',10000);

[x,fval] = fsolve(@blsprice,x0,options);

V1(1,j)=x(1);

sigmaV1(1,j)=x(2);

end

程序運行后顯示Error using erfc

Input must be real and full.

Error in normcdf>localnormcdf (line 124)

p(todo) = 0.5 * erfc(-z ./ sqrt(2));

Error in normcdf (line 46)

[varargout{1:max(1,nargout)}] =localnormcdf(uflag,x,varargin{:});

Error in blsprice (line 20)

F(1) = x(1)* normcdf(d1) - 0.97*B*normcdf(d2) -(E1_mean(1,j))/10^12;

Error in trustnleqn (line 200)

F= feval(funfcn{3},reshape(xTrial,sizes.xRows,sizes.xCols),varargin{:});

Error in fsolve (line 366)

[x,FVAL,JACOB,EXITFLAG,OUTPUT,msgData]=...

Error in solve_blsprice (line 9)

[x,fval] = fsolve(@blsprice,x0,options);

總結

以上是生活随笔為你收集整理的matlab计算方程fsolve,matlab中关于fsolve解非线性方程组的问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。