📄 sde_library_setup.m
字号:
if(isempty(Xzero))
error('X0 must be specified');
end
% store the parameters into the bigtheta array
bigtheta(1) = Xzero;
bigtheta(2) = a;
PARBASE = bigtheta; % the complete array of the user defined parameter values
elseif( strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'Y') )
fprintf('\n');
bigtheta(1:NUMDEPVARS) = XOBS(1,:); % subsititute the state variable(s) initial condition(s) with the first observed value(s)
PARBASE = [];
end % if( (strcmp(LOADDATA,'N') || strcmp(LOADDATA,'n')) && (strcmp(PARESTIMATE,'Y') || strcmp(PARESTIMATE,'y')) )
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PARMASK = [0,1]; % write 1 for parameters to be estimated and 0 for fixed parameters. WARNING: PARMASK(1) should always be set to zero (corresponds to the SDE initial condition)
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
case 'M6B'
PROBLEM = 'M6';
SDETYPE = 'Strat';
NUMDEPVARS = 1;
fprintf('\n\nYou choose [a * Xt ^ (1-1/a)] o dWt, X(0) = X0');
if( (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'N')) || (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'Y')) || (strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'N')) )
a = input('\n\nWrite the value of the ''a'' parameter: ');
if(isempty(a))
error('''a'' must be specified');
end
Xzero = input('\nWrite the value of the initial condition X0: ');
if(isempty(Xzero))
error('X0 must be specified');
end
% store the parameters into the bigtheta array
bigtheta(1) = Xzero;
bigtheta(2) = a;
PARBASE = bigtheta; % the complete array of the user defined parameter values
elseif( strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'Y') )
fprintf('\n');
bigtheta(1:NUMDEPVARS) = XOBS(1,:); % subsititute the state variable(s) initial condition(s) with the first observed value(s)
PARBASE = [];
end % if( (strcmp(LOADDATA,'N') || strcmp(LOADDATA,'n')) && (strcmp(PARESTIMATE,'Y') || strcmp(PARESTIMATE,'y')) )
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PARMASK = [0,1]; % write 1 for parameters to be estimated and 0 for fixed parameters. WARNING: PARMASK(1) should always be set to zero (corresponds to the SDE initial condition)
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%-------------------------------------------------------------------------------------------------------------------
case 'M7A'
PROBLEM = 'M7';
SDETYPE = 'Ito';
NUMDEPVARS = 1;
fprintf('\n\nYou choose dXt = [-1/2 * a^2 * Xt] * dt + a * sqrt(1 - Xt^2) * dWt, X(0) = X0');
if( (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'N')) || (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'Y')) || (strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'N')) )
a = input('\n\nWrite the value of the ''a'' parameter: ');
if(isempty(a))
error('''a'' must be specified');
end
Xzero = input('\nWrite the value of the initial condition X0: ');
if(isempty(Xzero))
error('X0 must be specified');
end
% store the parameters into the bigtheta array
bigtheta(1) = Xzero;
bigtheta(2) = a;
PARBASE = bigtheta; % the complete array of the user defined parameter values
elseif( strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'Y') )
fprintf('\n');
bigtheta(1:NUMDEPVARS) = XOBS(1,:); % subsititute the state variable(s) initial condition(s) with the first observed value(s)
PARBASE = [];
end % if( (strcmp(LOADDATA,'N') || strcmp(LOADDATA,'n')) && (strcmp(PARESTIMATE,'Y') || strcmp(PARESTIMATE,'y')) )
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PARMASK = [0,1]; % write 1 for parameters to be estimated and 0 for fixed parameters. WARNING: PARMASK(1) should always be set to zero (corresponds to the SDE initial condition)
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
case 'M7B'
PROBLEM = 'M7';
SDETYPE = 'Strat';
NUMDEPVARS = 1;
fprintf('\n\nYou choose dXt = a * sqrt(1 - Xt^2) o dWt, X(0) = X0');
if( (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'N')) || (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'Y')) || (strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'N')) )
a = input('\n\nWrite the value of the ''a'' parameter: ');
if(isempty(a))
error('''a'' must be specified');
end
Xzero = input('\nWrite the value of the initial condition X0: ');
if(isempty(Xzero))
error('X0 must be specified');
end
% store the parameters into the bigtheta array
bigtheta(1) = Xzero;
bigtheta(2) = a;
PARBASE = bigtheta; % the complete array of the user defined parameter values
elseif( strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'Y') )
fprintf('\n');
bigtheta(1:NUMDEPVARS) = XOBS(1,:); % subsititute the state variable(s) initial condition(s) with the first observed value(s)
PARBASE = [];
end % if( (strcmp(LOADDATA,'N') || strcmp(LOADDATA,'n')) && (strcmp(PARESTIMATE,'Y') || strcmp(PARESTIMATE,'y')) )
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PARMASK = [0,1]; % write 1 for parameters to be estimated and 0 for fixed parameters. WARNING: PARMASK(1) should always be set to zero (corresponds to the SDE initial condition)
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%-------------------------------------------------------------------------------------------------------------------
case 'M8A'
PROBLEM = 'M8';
SDETYPE = 'Ito';
NUMDEPVARS = 1;
fprintf('\n\nYou choose dXt = [a^2 * Xt * (1 + Xt^2)] * dt + a * (1 + Xt^2) * dWt, X(0) = X0');
if( (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'N')) || (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'Y')) || (strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'N')) )
a = input('\n\nWrite the value of the ''a'' parameter: ');
if(isempty(a))
error('''a'' must be specified');
end
Xzero = input('\nWrite the value of the initial condition X0: ');
if(isempty(Xzero))
error('X0 must be specified');
end
% store the parameters into the bigtheta array
bigtheta(1) = Xzero;
bigtheta(2) = a;
PARBASE = bigtheta; % the complete array of the user defined parameter values
elseif( strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'Y') )
fprintf('\n');
bigtheta(1:NUMDEPVARS) = XOBS(1,:); % subsititute the state variable(s) initial condition(s) with the first observed value(s)
PARBASE = [];
end % if( (strcmp(LOADDATA,'N') || strcmp(LOADDATA,'n')) && (strcmp(PARESTIMATE,'Y') || strcmp(PARESTIMATE,'y')) )
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PARMASK = [0,1]; % write 1 for parameters to be estimated and 0 for fixed parameters. WARNING: PARMASK(1) should always be set to zero (corresponds to the SDE initial condition)
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
case 'M8B'
PROBLEM = 'M8';
SDETYPE = 'Strat';
NUMDEPVARS = 1;
fprintf('\n\nYou choose dXt = a * (1 + Xt^2) o dWt, X(0) = X0');
if( (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'N')) || (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'Y')) || (strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'N')) )
a = input('\n\nWrite the value of the ''a'' parameter: ');
if(isempty(a))
error('''a'' must be specified');
end
Xzero = input('\nWrite the value of the initial condition X0: ');
if(isempty(Xzero))
error('X0 must be specified');
end
% store the parameters into the bigtheta array
bigtheta(1) = Xzero;
bigtheta(2) = a;
PARBASE = bigtheta; % the complete array of the user defined parameter values
elseif( strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'Y') )
fprintf('\n');
bigtheta(1:NUMDEPVARS) = XOBS(1,:); % subsititute the state variable(s) initial condition(s) with the first observed value(s)
PARBASE = [];
end % if( (strcmp(LOADDATA,'N') || strcmp(LOADDATA,'n')) && (strcmp(PARESTIMATE,'Y') || strcmp(PARESTIMATE,'y')) )
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PARMASK = [0,1]; % write 1 for parameters to be estimated and 0 for fixed parameters. WARNING: PARMASK(1) should always be set to zero (corresponds to the SDE initial condition)
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%-------------------------------------------------------------------------------------------------------------------
case 'M9A'
PROBLEM = 'M9';
SDETYPE = 'Ito';
NUMDEPVARS = 2;
fprintf('\n\nYou choose: dXt1 = [beta11 * alpha1 + beta12 * alpha2 - beta11 * Xt1 - beta12 * Xt2] * dt + sigma1 * dWt1, X1(0) = X01');
fprintf('\n dXt2 = [beta21 * alpha1 + beta22 * alpha2 - beta21 * Xt1 - beta22 * Xt2] * dt + sigma2 * dWt2, X2(0) = X02');
if( (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'N')) || (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'Y')) || (strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'N')) )
Xzero1 = input('\n\nWrite the value of the ''X01'' parameter: ');
Xzero2 = input('\n\nWrite the value of the ''X02'' parameter: ');
alpha1 = input('\n\nWrite the value of the ''alpha1'' parameter: ');
alpha2 = input('\n\nWrite the value of the ''alpha2'' parameter: ');
beta11 = input('\n\nWrite the value of the ''beta11'' parameter: ');
beta12 = input('\n\nWrite the value of the ''beta12'' parameter: ');
beta21 = input('\n\nWrite the value of the ''beta21'' parameter: ');
beta22 = input('\n\nWrite the value of the ''beta22'' parameter: ');
sigma1 = input('\n\nWrite the value of the ''sigma1'' parameter: ');
sigma2 = input('\n\nWrite the value of the ''sigma2'' parameter: ');
if(isempty(beta11)||isempty(beta21)||isempty(beta12)||isempty(beta22)||isempty(alpha1)||isempty(alpha2)||isempty(sigma1)||isempty(sigma2)||isempty(Xzero1)||isempty(Xzero2))
error('All the parameters must be specified');
end
% store the parameters into the bigtheta array
bigtheta(1) = Xzero1;
bigtheta(2) = Xzero2;
bigtheta(3) = alpha1;
bigtheta(4) = alpha2;
bigtheta(5) = beta11;
bigtheta(6) = beta12;
bigtheta(7) = beta21;
bigtheta(8) = beta22;
bigtheta(9) = sigma1;
bigtheta(10)= sigma2;
PARBASE = bigtheta; % the complete array of the user defined parameter values
elseif( strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'Y') )
fprintf('\n');
bigtheta(1:NUMDEPVARS) = XOBS(1,:); % subsititute the state variable(s) initial condition(s) with the first observed value(s)
PARBASE = [];
end % if( (strcmp(LOADDATA,'N') || strcmp(LOADDATA,'n')) && (strcmp(PARESTIMATE,'Y') || strcmp(PARESTIMATE,'y')) )
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PARMASK = [0,0,1,1,1,1,1,1,1,1]; % write 1 for parameters to be estimated and 0 for fixed parameters. WARNING: PARMASK(1) and PARMASK(2) should always be set to zero (correspond to the SDE initial conditions)
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
case 'M9B'
PROBLEM = 'M9';
SDETYPE = 'Strat';
NUMDEPVARS = 2;
fprintf('\n\nYou choose: dXt1 = [beta11 * alpha1 + beta12 * alpha2 - beta11 * Xt1 - beta12 * Xt2] * dt + sigma1 o dWt1, X1(0) = X01');
fprintf('\n dXt2 = [beta21 * alpha1 + beta22 * alpha2 - beta21 * Xt1 - beta22 * Xt2] * dt + sigma2 o dWt2, X2(0) = X02');
if( (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'N')) || (strcmp(LOADDATA,'N') && strcmp(PARESTIMATE,'Y')) || (strcmp(LOADDATA,'Y') && strcmp(PARESTIMATE,'N')) )
Xzero1 = input('\n\nWrite the value of the ''X01'' parameter: ');
Xzero2 = input('\n\nWrite the value of the ''X02'' parameter: ');
alpha1 = input('\n\nWrite the value of the ''alpha1'' parameter: ');
alpha2 = input('\n\nWrite the value of the ''alpha2'' parameter: ');
beta11 = input('\n\nWrite the value of the ''beta11'' parameter: ');
beta12 = input('\n\nWrite the value of the ''beta12'' parameter: ');
beta21 = input('\n\nWrite the value of the ''beta21'' parameter: ');
beta22 = input('\n\nWrite the value of the ''beta22'' parameter: ');
sigma1 = input('\n\nWrite the value of the ''sigma1'' parameter: ');
sigma2 = input('\n\nWrite the value of the ''sigma2'' parameter: ');
if(isempty(beta11)||isempty(beta21)||isempty(beta12)||isempty(beta22)||isempty(alpha1)||isempty(alpha2)||isempty(sigma1)||isempty(sigma2)||isempty(Xzero1)||isempty(Xzero2))
error('All the parameters must be specified');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -