Kalman filter for input estimation

14 views (last 30 days)
Piobaireachd
Piobaireachd on 20 Jan 2024
Edited: Paul on 21 Jan 2024
I'm trying to develop a Kalman filter (using the control systems toolbox) to estimate the input force to a 2DOF mechanical system. I've implemented the problem augmenting the original plant state matrix with the unknown force f as an additional state. The real force is unknown, but in the application is a superposition of sinusoids or constant. I'm struggling in how to implement its own dynamics
Given the original plant xdot=Ax+Bf+Gw, the augmented states are xaug=[x; f] and the new matrices
Aaug = [ A B; 0 0 ] Baug = [0; 0] Gaug=[G; I]
Caug = [C D]; Daug=0
That is for zero-order dynamics and with the force subject to random noise. However, this realization is not minimal and the command kalman doesn't work. The lines of code for the rest of the problem are
sys=ss(Aaug,Baug,Caug,Daug,'InputName',{'u' 'w'},'OutputName','yt')
[kalmf,L,~,Mx,Z] = kalman(sys,Qn,Rn);
kalmf.InputName = {'u' 'y'};
kalmf.OutputName = {'ye'};
vIn = sumblk('y=yt+v', size(Caug,1));
TotalPlant = connect(sys,vIn,kalmf,{inputName{:}, sensorNoiseName{:}},{'yt','ye'});
How could I implement this problem?
  1 Comment
Benjamin Thompson
Benjamin Thompson on 21 Jan 2024
Edited: Benjamin Thompson on 21 Jan 2024
Please provide more code that defines al variables including A, B, G, I. Try looking in the documentation, type "doc kalman". It looks like you should call the kalman function using the "TotalPlant" system rather than the "sys" system. Without more code to reproduce your problem it is hard to know.

Sign in to comment.

Answers (1)

Paul
Paul on 21 Jan 2024
Edited: Paul on 21 Jan 2024
The steady-state Kalman filter as implemented by kalman requires that the augmented realization be detectable, as opposed to minimal. Offhand, it's not clear why it wouldn't be detectable, assuming the original system is detectable and is controllable (maybe only stabilizable?) from f (I think that would be the requirement, but not 100% sure). Need to see all of the matrices involved to say for sure what the issue is for this particular problem.
Suggest rechecking the formulation of the augmented system. The original system is
xdot = A*x + B*f + G*w
y = C*x + D*f
The model for f looks like it's intended to be (is this correct?):
fdot = wf
where wf is a vector of additional external noise inputs.
Subbing in we have
[xdot;fdot] == [A B;0 0]*[x;f] + [G 0;0 I]*[w;wf]
y = [C D]*[x;f] + 0*[w;wf]
Gaug should be a block diagonal matrix.
In these lines, Baug should be replaced with Gaug.
sys=ss(Aaug,Baug,Caug,Daug,'InputName',{'u' 'w'},'OutputName','yt')
[kalmf,L,~,Mx,Z] = kalman(sys,Qn,Rn);
The name of the first input variable ('u') seems suspicious.
Feel free to upload all the variable involved in this problem in .mat file (use the paperclip icon on the Insert menu) for further investigation if necessary.

Community Treasure Hunt

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

Start Hunting!