Info

This question is closed. Reopen it to edit or answer.

Can someone please explain me the code and how can i give my input in it?

1 view (last 30 days)
I want a kalman filter with two inputs and one output port; 1st Input is a excel sheet with 16801x28 and 2nd is a sample of which i want to see how close are the values to the original which again is a excel sheet of 6rows and 28 columns. Can someone please explain the code given below and tell me where can i input my two excel sheet inputs Thanks in advance
numSamples = 4000;
R = 0.02;
src = dsp.SignalSource;
src.Signal = [ones(numSamples/4,1); -3*ones(numSamples/4,1);...
4*ones(numSamples/4,1); -0.5*ones(numSamples/4,1)];
tScope = dsp.TimeScope('NumInputPorts', 3, 'TimeSpan', numSamples, ...
'TimeUnits', 'Seconds', 'YLimits',[-5 5], ...
'ShowLegend', true); % Create the Time Scope
kalman = dsp.KalmanFilter('ProcessNoiseCovariance', 0.0001,...
'MeasurementNoiseCovariance', R,...
'InitialStateEstimate', 5,...
'InitialErrorCovarianceEstimate', 1,...
'ControlInputPort',false); %Create Kalman filter
while(~isDone(src))
trueVal = src();
noisyVal = trueVal + sqrt(R)*randn;
estVal = kalman(noisyVal);
tScope(noisyVal,trueVal,estVal);
end

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!