Using the Kalman Filter block with multiple inputs u.
29 ビュー (過去 30 日間)
古いコメントを表示
I have state space equations that depend on a B matrix that has 2 columns, corresponding to having 2 inputs to my system, which are in this case two voltage sources. I would like the Kalman filter block to take both of these inputs and produce the full state estimation of the system. I'm encountering issues with the dimensions of the signals though, as the error I'm receiving is that the input dimensions to my Kalman filter must be 2x1, and then a second error stating that the output of the u port is a one dimensional vector with one element.
Is it even possible to use 2 input signals for the Kalman filter block in simulink, or am I messing up the muxing somehow? Any help is appreciated and I've attatched a picture of the sim. Attatched is also my matlab code that runs the sim.
3 件のコメント
Sam Chak
2022 年 7 月 21 日
Previously, I thought your system is deterministic. Since your system is stochastic, then use the Kalman Filter to estimate the states.
回答 (1 件)
Christine Li
2022 年 7 月 22 日
編集済み: Christine Li
2022 年 7 月 22 日
Hello,
From your code, it looks the C matrix is 1-by-6, which should be 1-by-5 to be consistent with A and B matrix dimention. More specifically, it looks you have 5 states, 2 inputs and 1 outputs. Since y = Cx + Du, so the C matrix should be in a dimention of [numY by numX] which turns out to be 1 by 5.
For Kalman Filter design with MATLAB and Simulink, here are some references:
You can use MATLAB script to create the state-space model and call 'kalman' to estimate the states. Here is an example: Design Kalman Filter for MIMO Plant
If you are working in Simulink with Kalman Filter block, you just need to make sure the A, B, C, D matrixes and Q,R are consistent in dimention. As for the example shown above, here is the simulink model screenshot you can refer to:
For your model, there are 2 inputs, you can use a mux to combine the inputs. Please notes that Simulink can automatically handle the signal dimentional. Therefore, if your input signal is already multil-dimentional, you can just feed it in the block, as long as the dimention is consistent with A,B,C,D matrix, the model will be good to run.
To debug the dimention issues in Simulink, you can go to toolstrip tab - Debug ->Information Overlays and turn on the "Signal Dimensions".
Regards,
Christine Li
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!