Reference to non-existent field
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Jony Bench
el 11 de Mayo de 2021
Comentada: Image Analyst
el 11 de Mayo de 2021
Hello i'm new to matlab, this is my error "Reference to non-existent field 'sigmaV'."
This is my code:
%Script tests the particle filter
%simulation parameters
%[sigma sigmaN mu F/V_end]
param_real=[.25 0.0001 .18 1];
sigma=param_real(1); %asset volatility
delta=param_real(2); %measurement noise
mu=param_real(3); %asset drift
F0=1; %debt
V_end=F0/param_real(4); %end-of-sample pseudo-leverage
r=.05; %riskfree rate
dt=1/250; %observation frequency
T=10; %beginning maturity
t=9; %end-of-sample maturity
%number of simulated paths
Npath=1;
randn('state',0);
%%%%%%%%%%%%%%%%
%Simulate paths%
%%%%%%%%%%%%%%%%
for m=1:Npath
[S(:,m),AssetValue(:,m),mat]=SimMerton_Equity(V_end,dt,mu,r,sigma,F0,T,t,delta);
end
%%%%%%%%%%%%%%%%%%%%%%%
%set filter parameters%
%%%%%%%%%%%%%%%%%%%%%%%
samplesize=length(mat);
F=ones(samplesize,1)*F0;
modelparam.dt=dt;
modelparam.r=r;
modelparam.sigma=sigma/20;
modelparam.mu=mu;
modelparam.delta=delta;
%number of particles
M=1000;
R=1000;
%random number seed to filter
seed=0;
%generate prior
Prior=log(AssetValue(1))+randn(M,1)*.1;
%%%%%%%%%%%%
%Run Filter%
%%%%%%%%%%%%
tic
[L,V]=feval('LocalizedFilter',modelparam,Prior,R,seed,S(1:100),F(1:100),mat(1:100));
toc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%loglikelihood from transformed data method%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
L3=Merton_loglvec([modelparam.sigmaV modelparam.mu],S(1:100),r,F(1:100),mat(1:100),modelparam.dt);
0 comentarios
Respuesta aceptada
Image Analyst
el 11 de Mayo de 2021
I see you assigned
modelparam.sigma=sigma/20;
but where exactly did you assign
modelparam.sigmaV = ?????????????????????
I'm not seeing it. You need to assign it some value. Or maybe you want to use modelparam.sigma instead of modelparam.sigmaV???
3 comentarios
Image Analyst
el 11 de Mayo de 2021
Evidently S_observed and F don't have the same lengths. It says that. What does it say in the workspace that their lengths are?
Más respuestas (0)
Ver también
Categorías
Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!