Problem defining ssm (state-space model) using Parameter Mapping function
Show older comments
I am trying to define a state-space model using parameter mapping. According to the documentation (https://www.mathworks.com/help/econ/ssm-class.html), I should be able use
Mdl = ssm(@(params)ParamFun(params))
with input vector params and function ParamFun that returns required inputs for ssm. Using the following works fine:
clear;
params = [0.5 0.5 0.004 ];
[ A , B , C ] = paramfun( params ) ;
Mdl = ssm( A , B , C );
function [A,B,C,D,Mean0,Cov0,StateType,DeflateY] = paramfun( params )
A = zeros(7,7);
A(1,1) = params(1);
A(2:end,1) = params(2);
B = zeros(7,7);
B(:,1) = params(3);
C = [ zeros(3,4) eye(3,3) ];
D = [];Mean0 = [];Cov0 = [];StateType = [];DeflateY = [];
end
This gives the Mdl with the correct properties. However, using:
clear;
params = [0.5 0.5 0.004 ];
Mdl = ssm(@(params)paramfun(params));
function [A,B,C,D,Mean0,Cov0,StateType,DeflateY] = paramfun( params )
A = zeros(7,7);
A(1,1) = params(1);
A(2:end,1) = params(2);
B = zeros(7,7);
B(:,1) = params(3);
C = [ zeros(3,4) eye(3,3) ];
D = [];Mean0 = [];Cov0 = [];StateType = [];DeflateY = [];
end
gives empty arrays for all the properties in Mdl except ParamMap which gives the function handle above.
Any clue where I'm going wrong? Thanks in advance.
Answers (0)
Categories
Find more on Standard State-Space Model in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!