matlab coding to s-function level 2 coding.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
Using Matlab, i can initialize the particle filter like this:
for i = 1 : N
xhatplus(:,i) = xhat + sqrt(P) * [randn; randn; randn];
end
Now, i want to use simulink s-function level 2. how should i coding it?
function DoPostPropSetup(block)
block.Dwork(3).Name = 'xhatplus';
block.Dwork(3).Dimensions = N*3;
block.Dwork(3).DatatypeID = 0;
block.Dwork(3).Complexity = 'Real';
block.Dwork(3).UsedAsDiscState = true;
function InitializeConditions(block)
block.Dwork(3).Data = ??
Any advise? Thanks.
2 comentarios
Respuesta aceptada
Kaustubha Govind
el 3 de Feb. de 2012
Oops, just realized that you are asking about the InitializeConditions function, and not Update or Outputs. The initial condition of your state depends on the dynamics of your system or application - it's hard for us to tell what it should be. The only thing that I can say is that it needs to be of size 3000. For example, for zero-initial condition, you can say:
block.Dwork(3).Data = zeros(3, N);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Audio Processing Algorithm Design en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!