Problem defining ssm (state-space model) using Parameter Mapping function

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.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Standard State-Space Model에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2018년 6월 29일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by