亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? blackscholes.m

?? 一種新的改進的UPF粒子濾波
?? M
?? 第 1 頁 / 共 2 頁
字號:
% PURPOSE : Demonstrate the differences between the following% filters on an options pricing problem.%           %           1) Extended Kalman Filter  (EKF)%           2) Unscented Kalman Filter (UKF)%           3) Particle Filter         (PF)%           4) PF with EKF proposal    (PFEKF)%           5) PF with UKF proposal    (PFUKF)% For more details refer to:% AUTHORS  : Nando de Freitas      (jfgf@cs.berkeley.edu)%            Rudolph van der Merwe (rvdmerwe@ece.ogi.edu)%            + We re-used a bit of code by Mahesan Niranjan.             % DATE     : 17 August 2000clear all;echo off;path('./ukf',path);path('./data',path);% INITIALISATION AND PARAMETERS:% ==============================doPlot = 0;                 % 1 plot online. 0 = only plot at the end.g1 = 3;                     % Paramater of Gamma transition prior.g2 = 2;                     % Parameter of Gamman transition prior.                            % Thus mean = 3/2 and var = 3/4.T = 204;                    % Number of time steps.R = diag([1e-5 1e-5]);      % EKF's measurement noise variance. Q = diag([1e-7 1e-5]);      % EKF's process noise variance.P01 = 0.1;                  % EKF's initial variance of the                            % interest rate.P02 = 0.1;                  % EKF's initial variance of the volatility.N = 10;                     % Number of particles.optionNumber = 1;           % There are 5 pairs of options.resamplingScheme = 1;       % The possible choices are                            % systematic sampling (2),                            % residual (1)                            % and multinomial (3).                             % They're all O(N) algorithms. P01_ukf = 0.1;P02_ukf = 0.1;			    Q_ukf = Q;R_ukf = R;			    initr = .01;initsig = .15;Q_pfekf = 10*1e-5*eye(2);R_pfekf = 1e-6*eye(2);Q_pfukf = Q_pfekf;R_pfukf = R_pfekf;			    alpha = 1;                     % UKF : point scaling parameterbeta  = 2;                     % UKF : scaling parameter for higher order terms of Taylor series expansion kappa = 1;                     % UKF : sigma point selection scaling parameter (best to leave this = 0)no_of_experiments = 1;         % Number of times the experiment is                               % repeated (for statistical purposes).% DATA STRUCTURES FOR RESULTS% ===========================errorcTrivial = zeros(no_of_experiments,1);errorpTrivial = errorcTrivial;errorcEKF     = errorcTrivial;errorpEKF     = errorcTrivial;errorcUKF     = errorcTrivial;errorpUKF     = errorcTrivial;errorcPF      = errorcTrivial;errorpPF      = errorcTrivial;errorcPFEKF   = errorcTrivial;errorpPFEKF   = errorcTrivial;errorcPFUKF   = errorcTrivial;errorpPFUKF   = errorcTrivial;% LOAD THE DATA:% =============fprintf('\n')fprintf('Loading the data')fprintf('\n')load c2925.prn;         load p2925.prn;load c3025.prn;         load p3025.prn;load c3125.prn;         load p3125.prn;load c3225.prn;         load p3225.prn;load c3325.prn;         load p3325.prn;X=[2925; 3025; 3125; 3225; 3325];[d1,i1]=sort(c2925(:,1));  Y1=c2925(i1,:);      Z1=p2925(i1,:);[d2,i2]=sort(c3025(:,1));  Y2=c3025(i2,:);      Z2=p3025(i2,:);[d3,i3]=sort(c3125(:,1));  Y3=c3125(i3,:);      Z3=p3125(i3,:);[d4,i4]=sort(c3225(:,1));  Y4=c3225(i4,:);      Z4=p3225(i4,:);[d5,i5]=sort(c3325(:,1));  Y5=c3325(i5,:);      Z5=p3325(i5,:);d=Y1(:,1); % d - date to maturity.St(1,:) = Y1(:,3)';   C(1,:) = Y1(:,2)';  P(1,:) = Z1(:,2)';St(2,:) = Y2(:,3)';   C(2,:) = Y2(:,2)';  P(2,:) = Z2(:,2)';St(3,:) = Y3(:,3)';   C(3,:) = Y3(:,2)';  P(3,:) = Z3(:,2)';St(4,:) = Y4(:,3)';   C(4,:) = Y4(:,2)';  P(4,:) = Z4(:,2)';St(5,:) = Y5(:,3)';   C(5,:) = Y5(:,2)';  P(5,:) = Z5(:,2)';% St - Stock price.% C - Call option price.% P - Put Option price.% X - Strike price.% Normalise with respect to the strike price:for i=1:5   Cox(i,:) = C(i,:) / X(i);   Sox(i,:) = St(i,:) / X(i);   Pox(i,:) = P(i,:) / X(i);endCpred=zeros(T,5);Ppred=zeros(T,5);% PLOT THE LOADED DATA:% ====================figure(1)clf;plot(Cox');ylabel('Call option prices','fontsize',15);xlabel('Time to maturity','fontsize',15);fprintf('\n')fprintf('Press a key to continue')  pause;fprintf('\n')fprintf('\n')fprintf('Training has started')fprintf('\n')% SPECIFY THE INPUTS AND OUTPUTS% ==============================ii=optionNumber;   % Only one call price. Change 1 to 3, etc. for other prices.X = X(ii,1);St = Sox(ii,1:T);C = Cox(ii,1:T);P = Pox(ii,1:T);counter=1:1:T;tm = (224*ones(size(counter))-counter)/260;u = [St' tm']';y = [C' P']'; % Call and put prices.% MAIN LOOP% =========for expr=1:no_of_experiments,  rand('state',sum(100*clock));   % Shuffle the pack!  randn('state',sum(100*clock));   % Shuffle the pack!    %%%%%%%%%%%%%%%  PERFORM EKF and UKF ESTIMATION  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ==============================  %%%%%%%%%%%%%%%%%%%%%% INITIALISATION:% ==============mu_ekf = ones(2,T);       % EKF estimate of the mean of the states.Inn = ones(2,2,T);        % Innovations Covariance.Inn_ukf = Inn;mu_ekf(1,1) = initr;mu_ekf(2,1) = initsig;P_ekf = ones(2,2,T);      % EKF estimate of the variance of the states.for t=1:T  P_ekf(:,:,t)= diag([P01 P02]);end;mu_ukf = mu_ekf;        % UKF estimate of the mean of the states.P_ukf = P_ekf;          % UKF estimate of the variance of the states.yPred = ones(2,T);      % One-step-ahead predicted values of y.yPred_ukf = yPred;mu_ekfPred = mu_ekf;    % EKF O-s-a estimate of the mean of the states.PPred =eye(2);          % EKF O-s-a estimate of the variance of the states.disp(' ');for t=2:T,      fprintf('EKF & UKF : t = %i / %i  \r',t,T);  fprintf('\n')    % EKF PREDICTION STEP:  % ====================   mu_ekfPred(:,t) = feval('bsffun',mu_ekf(:,t-1),t);  Jx = eye(2);  % Jacobian for bsffun.    PPred = Q + Jx*P_ekf(:,:,t-1)*Jx';     % EKF CORRECTION STEP:  % ====================  yPred(:,t) = feval('bshfun',mu_ekfPred(:,t),u(:,t),t);  % COMPUTE THE JACOBIAN:  St  = u(1,t);            % Index price.  tm  = u(2,t);            % Time to maturity.  r   = mu_ekfPred(1,t);   % Risk free interest rate.  sig = mu_ekfPred(2,t);   % Volatility.    d1 = (log(St) + (r+0.5*(sig^2))*tm ) / (sig * (tm^0.5));  d2 = d1 - sig * (tm^0.5);    % Differentials of call price  dcsig = St * sqrt(tm) * exp(-d1^2) / sqrt(2*pi);  dcr   = tm * exp(-r*tm) * normcdf(d2);  % Differentials of put price  dpsig = dcsig;  dpr   = -tm * exp(-r*tm) * normcdf(-d2);  Jy = [dcr dpr; dcsig dpsig]'; % Jacobian for bshfun.  % APPLY THE EKF UPDATE EQUATIONS:  M = R + Jy*PPred*Jy';                 % Innovations covariance.  Inn(:,:,t)=M;  K = PPred*Jy'*inv(M);                 % Kalman gain.  mu_ekf(:,t) = mu_ekfPred(:,t) + K*(y(:,t)-yPred(:,t));  P_ekf(:,:,t) = PPred - K*Jy*PPred;    % Full Unscented Kalman Filter step  % =================================  [mu_ukf(:,t),P_ukf(:,:,t),zab1,zab2,yPred_ukf(:,t),inov_ukf,Inn_ukf(:,:,t),K_ukf]=ukf(mu_ukf(:,t-1),P_ukf(:,:,t-1),u(:,t),Q_ukf,'ukf_bsffun',y(:,t),R_ukf,'ukf_bshfun',t,alpha,beta,kappa);  end;   % End of t loop.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-- CALCULATE PERFORMANCE --%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%figure(3)clf;subplot(211)p1=plot(1:T,mu_ekf(1,:),'r','linewidth',2);hold on;p2=plot(1:T,mu_ukf(1,:),'b','linewidth',2);hold off;legend([p1 p2],'ekf','ukf');ylabel('Interest rate','fontsize',15)subplot(212)p1=plot(1:T,mu_ekf(2,:),'r','linewidth',2);hold on;p2=plot(1:T,mu_ukf(2,:),'b','linewidth',2);hold off;ylabel('Volatility','fontsize',15);xlabel('Time (days)','fontsize',15)zoom on;% Transform innovations covariance for plotting.Inn11=zeros(1,T);Inn22=zeros(1,T);Pekf11=zeros(1,T);Pekf22=zeros(1,T);for t=1:T,  Inn11(t)=Inn(1,1,t);  Inn22(t)=Inn(2,2,t);  Inn11_ukf(t)=Inn_ukf(1,1,t);  Inn22_ukf(t)=Inn_ukf(2,2,t);  Pekf11(t)=P_ekf(1,1,t);  Pekf22(t)=P_ekf(2,2,t);  Pukf11(t)=P_ukf(1,1,t);  Pukf22(t)=P_ukf(2,2,t);end;figure(1)clf;subplot(211)plot(1:T,y(1,:),'r--',1:T,yPred(1,:),'b','linewidth',2);hold on;plot(1:T,yPred(1,:)+2*sqrt(Inn11),'k',1:T,yPred(1,:)-2*sqrt(Inn11),'k')ylabel('Call price','fontsize',15)legend('Actual price','Prediction');axis([0 204 0.03 .22])title('EKF');subplot(212)plot(1:T,y(2,:),'r--',1:T,yPred(2,:),'b','linewidth',2);hold on;plot(1:T,yPred(2,:)+2*sqrt(Inn22),'k',1:T,yPred(2,:)-2*sqrt(Inn22),'k')ylabel('Put price','fontsize',15)xlabel('Time (days)','fontsize',15)axis([0 204 0 .06])zoom on;legend('Actual price','Prediction');figure(2)clf;subplot(211)plot(1:T,y(1,:),'r--',1:T,yPred_ukf(1,:),'b','linewidth',2);hold on;plot(1:T,yPred_ukf(1,:)+2*sqrt(Inn11_ukf),'k',1:T,yPred_ukf(1,:)-2*sqrt(Inn11_ukf),'k')ylabel('Call price','fontsize',15)legend('Actual price','Prediction');axis([0 204 0.03 .22])title('UKF');subplot(212)plot(1:T,y(2,:),'r--',1:T,yPred_ukf(2,:),'b','linewidth',2);hold on;plot(1:T,yPred_ukf(2,:)+2*sqrt(Inn22_ukf),'k',1:T,yPred_ukf(2,:)-2*sqrt(Inn22_ukf),'k')ylabel('Put price','fontsize',15)xlabel('Time (days)','fontsize',15)axis([0 204 0 .06])zoom on;legend('Actual price','Prediction');%%%%%%%%%%%%%%%  PERFORM SEQUENTIAL MONTE CARLO  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ==============================  %%%%%%%%%%%%%%%%%%%%%% INITIALISATION:% ==============xparticle_pf = ones(2,T,N);      % These are the particles for the estimate                                 % of x. Note that there's no need to store                                 % them for all t. We're only doing this to                                 % show you all the nice plots at the end.xparticlePred_pf = ones(2,T,N);    % One-step-ahead predicted values of the states.yPred_pf = ones(2,T,N);            % One-step-ahead predicted values of y.w = ones(T,N);                   % Importance weights.% Initialisation:for i=1:N,  xparticle_pf(1,1,i) = initr; % sqrt(initr)*randn(1,1);  xparticle_pf(2,1,i) = initsig; %sqrt(initsig)*randn(1,1);end;disp(' '); tic;                             % Initialize timer for benchmarkingfor t=2:T,      fprintf('PF :  t = %i / %i  \r',t,T);  fprintf('\n')    % PREDICTION STEP:  % ================   % We use the transition prior as proposal.  for i=1:N,    xparticlePred_pf(:,t,i) = feval('bsffun',xparticle_pf(:,t-1,i),t) + sqrtm(Q)*randn(2,1);      end;  % EVALUATE IMPORTANCE WEIGHTS:  % ============================  % For our choice of proposal, the importance weights are give by:    for i=1:N,    yPred_pf(:,t,i) = feval('bshfun',xparticlePred_pf(:,t,i),u(:,t),t);            lik = exp(-0.5*(y(:,t)-yPred_pf(:,t,i))'*inv(R)*(y(:,t)-yPred_pf(:,t,i)) ) + 1e-99; % Deal with ill-conditioning.    w(t,i) = lik;      end;    w(t,:) = w(t,:)./sum(w(t,:));                % Normalise the weights.    % SELECTION STEP:  % ===============  % Here, we give you the choice to try three different types of  % resampling algorithms. Note that the code for these algorithms  % applies to any problem!  if resamplingScheme == 1    outIndex = residualR(1:N,w(t,:)');        % Residual resampling.  elseif resamplingScheme == 2    outIndex = systematicR(1:N,w(t,:)');      % Systematic resampling.  else      outIndex = multinomialR(1:N,w(t,:)');     % Multinomial resampling.    end;  xparticle_pf(:,t,:) = xparticlePred_pf(:,t,outIndex); % Keep particles with                                                    % resampled indices.end;   % End of t loop.time_pf = toc;    % How long did this take?% Compute posterior mean predictions:yPFmeanC=zeros(1,T);yPFmeanP=zeros(1,T);for t=1:T,  yPFmeanC(t) = mean(yPred_pf(1,t,:));  yPFmeanP(t) = mean(yPred_pf(2,t,:));  end;  figure(4)clf;domain = zeros(T,1);range = zeros(T,1);thex=[0:1e-3:20e-3];hold onylabel('Time (t)','fontsize',15)xlabel('r_t','fontsize',15)zlabel('p(r_t|S_t,t_m,C_t,P_t)','fontsize',15)for t=11:20:200,  [range,domain]=hist(xparticle_pf(1,t,:),thex);  waterfall(domain,t,range/sum(range));end;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美亚洲愉拍一区二区| 欧美日韩亚洲国产综合| 亚洲亚洲精品在线观看| 久久久久久久久久看片| 色狠狠av一区二区三区| 国产真实精品久久二三区| 亚洲尤物视频在线| 中文欧美字幕免费| 欧美大片日本大片免费观看| 色婷婷综合在线| 成人在线视频首页| 奇米一区二区三区av| 一区二区三国产精华液| 国产精品久久99| 久久女同精品一区二区| 欧美一区二区三区白人| 欧美丝袜丝交足nylons图片| av网站一区二区三区| 国产精品99久久久久久有的能看 | 国产一区二区三区免费看| 亚洲电影一区二区三区| 综合色天天鬼久久鬼色| 国产婷婷色一区二区三区在线| 日韩一级精品视频在线观看| 欧美丝袜第三区| 一本大道久久a久久精二百| 成人av在线网站| 福利电影一区二区三区| 国产在线视频一区二区三区| 另类人妖一区二区av| 免费在线观看一区| 日本伊人色综合网| 天天操天天综合网| 天天影视色香欲综合网老头| 亚洲va韩国va欧美va精品| 一区二区三区四区在线| 亚洲精品中文字幕乱码三区| 18欧美亚洲精品| 亚洲欧美一区二区三区国产精品 | 日本女人一区二区三区| 午夜精品久久久久| 国产成人啪免费观看软件| 蜜臀精品久久久久久蜜臀| 日本午夜一区二区| 麻豆免费看一区二区三区| 久久精品久久久精品美女| 另类欧美日韩国产在线| 国内偷窥港台综合视频在线播放| 精品一区二区三区在线播放| 九一久久久久久| 国产精品一级在线| 成人激情av网| 精品视频在线看| 欧美肥妇毛茸茸| 精品免费日韩av| 国产三级精品在线| 亚洲人妖av一区二区| 一级做a爱片久久| 日韩精品欧美成人高清一区二区| 三级欧美在线一区| 精品无人区卡一卡二卡三乱码免费卡| 国产综合成人久久大片91| 国产91清纯白嫩初高中在线观看| 91在线小视频| 欧美老女人在线| 337p粉嫩大胆色噜噜噜噜亚洲 | 丝袜美腿亚洲一区| 美女视频一区在线观看| 国产另类ts人妖一区二区| 成人av网站在线观看| 欧美在线视频不卡| 欧美电视剧免费全集观看| 亚洲国产精品ⅴa在线观看| 一区二区三区**美女毛片| 人人超碰91尤物精品国产| 国产成人夜色高潮福利影视| 日本丰满少妇一区二区三区| 日韩欧美一二区| 1000精品久久久久久久久| 日韩制服丝袜先锋影音| 床上的激情91.| 欧美日韩国产免费一区二区| 久久久久久97三级| 亚洲电影在线播放| 国产精品夜夜爽| 欧美综合天天夜夜久久| 久久精品综合网| 亚洲国产你懂的| 国产福利一区二区三区视频| 欧美日韩在线三区| 亚洲国产精品成人综合色在线婷婷 | 欧美情侣在线播放| 国产精品亲子乱子伦xxxx裸| 成人黄色在线网站| 欧美日韩1区2区| 中文字幕在线观看不卡| 蜜桃精品视频在线观看| 91高清视频免费看| 国产日产精品一区| 美腿丝袜在线亚洲一区 | 欧美成人一区二区三区在线观看| 中文字幕亚洲一区二区va在线| 日韩和的一区二区| 91久久人澡人人添人人爽欧美 | 亚洲国产精品天堂| 大桥未久av一区二区三区中文| 91精品国产综合久久久蜜臀图片| 国产精品国产三级国产三级人妇| 精品伊人久久久久7777人| 精品视频一区二区三区免费| 亚洲婷婷综合久久一本伊一区 | 91影院在线免费观看| www欧美成人18+| 日韩精品一级中文字幕精品视频免费观看 | 91丨九色丨国产丨porny| 亚洲精品一区二区三区四区高清| 婷婷开心久久网| 欧美系列亚洲系列| 亚洲免费观看高清| 成人不卡免费av| 亚洲国产精品成人综合色在线婷婷| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美视频中文字幕| 亚洲国产日产av| 在线一区二区三区四区五区| 综合久久一区二区三区| 成人av小说网| 国产精品色呦呦| 成人丝袜视频网| 国产拍欧美日韩视频二区| 国产在线精品一区二区不卡了| 日韩欧美色电影| 裸体一区二区三区| 日韩女同互慰一区二区| 奇米在线7777在线精品| 欧美一区二区高清| 老司机精品视频线观看86 | 国产婷婷一区二区| 国产宾馆实践打屁股91| 国产亚洲制服色| 国产大陆亚洲精品国产| 欧美国产1区2区| av日韩在线网站| 亚洲蜜臀av乱码久久精品| 色哟哟欧美精品| 亚洲电影第三页| 欧美一区二区高清| 国产一区二区三区在线看麻豆| 久久色视频免费观看| 岛国一区二区在线观看| 亚洲天堂福利av| 欧美三级在线视频| 热久久免费视频| 26uuu久久天堂性欧美| 国产大陆精品国产| 亚洲人成网站在线| 欧美在线短视频| 免费看日韩精品| 久久精品一区四区| 91一区二区在线观看| 亚洲高清在线精品| 日韩欧美国产三级| 成人午夜视频免费看| 亚洲色图20p| 亚洲特黄一级片| 欧美日韩精品欧美日韩精品| 日本最新不卡在线| 国产日韩欧美制服另类| 一本久久a久久精品亚洲| 日精品一区二区三区| 久久久久久亚洲综合| 色视频一区二区| 麻豆精品久久精品色综合| 欧美韩国一区二区| 欧美性猛交xxxx黑人交| 九一九一国产精品| 亚洲精品福利视频网站| 91精品在线麻豆| 成人黄色软件下载| 视频在线观看91| 欧美激情在线看| 欧美日本国产视频| 国产99久久精品| 婷婷成人激情在线网| 国产欧美精品一区二区三区四区| 欧洲一区在线观看| 国产乱对白刺激视频不卡| 一区二区三区欧美久久| 久久天天做天天爱综合色| 91国产丝袜在线播放| 国产一区二区调教| 午夜视频在线观看一区| 国产精品久久三| 欧美xxxxxxxx| 欧美私模裸体表演在线观看| 成人一区二区三区中文字幕| 日日欢夜夜爽一区| 亚洲另类在线制服丝袜| 久久精品亚洲精品国产欧美| 91精品国模一区二区三区|