Integrate in embedded matlab function
Mostrar comentarios más antiguos
Hi,
i am developing continuous EKF using embedded matlab function.In this i need to integrate xhatdot and Pdot. Can i integrate it within embedded matlab function block without post the result and using the integrator outside the embedded block as i need P to calculate K(gain) and xhat to update the states in the block. Any idea how should i solve this? The code as below:
F = [4x4 matrices] %%Jacobian
H = [0 1 0 0; 0 0 1 0]; %%Measurement
xhatdot = [4x4 matices];
%xhatdot(t)--how to integrate to get xhat??? need xhat to update state
Pdot = F * P + F'*P + Q - P * H' * inv(R) * H * P;
Pdot(t)--how to integrate to get P ??? need P to calculate K
%%Kalman gain -K(t)
K =(P*H')/(H*P*H'+R);
%update the state
xhat = xhat + K * (meas - H*xhat);
%%Post the result
xhatout=xhat;
Respuesta aceptada
Más respuestas (1)
Guy Rouleau
el 25 de En. de 2012
0 votos
If your EML block is continuous, I recommend outputting the "dx" signal, feed it to an Integrator block and connect the output of the integrator as an Input to the EML block.
This will let the Simulink take care of the job. The solver you choose in the Simulink configuration will be used for the integration (ode45, ode15s, ode3, etc...).
Categorías
Más información sobre Parallel Computing Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!