function [x, y, typ] = Kalman_Filter_IF(job, arg1, arg2)
x = [];
y = [];
typ = [];
getinput
x0_set=[];
covariance_matrix =[];
select job
// Initialize with mask parameters if any
case "set" then
x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
if getInputFromSim==1 then
exec("macros/Kalman_Filter_Utils.sci",-1);// Contains function declaration for this file
title="Set Parameters";
labels = ['Initial state [x_dot(velosity), x(position)] which is position in ECEF frame and velocity';'Covariance which gives the uncertainty at position and velocity']; // Changed 'Stiffness' to 'Covariance'
// In future we can add ;'Accelerations';'Orientations which is obation altitude control system
types = list('vec', 2, 'mat', 2); // Changed 'vec' to 'mat' for Covariance
// Create a dialog for getting user inputs
while ~endLoop do
// Initialize dialog for parameters and initial state
[ok, Initial_state, covariance_matrix, exprs] = scicos_getvalue("Set Properties and State", labels, types, exprs);
errMsg=[];
// Check return // set conditions of the initial state as per meetings
if ~ok then
// depends on what type of data we are having
if condition1 then // first condition of position and velocity
errMsg=[];
end
if condition2 then // second condition of velocity
errMsg=[];
end
if isempty(errMsg)then
[];// from here start working
// Check parameters
// You can add additional checks for input parameters here if needed
// Accept inputs and save them
if ok then
// Concatenate the covariance matrix to the state vector
model.state = [x0_set, covariance_matrix]; // Use the concatenation operator ":" for the matrix
graphics.exprs = exprs;
x.graphics = graphics;
x.model = model;
break;
else
message("Failed to update block io");
end
end
// Define block properties
case "define" then
// Create object
model = scicos_model();
// Provide name and type
model.sim = list("Kalman_Filter_sim", 5);
// Define inputs and outputs
// One input with a variable-size "double" element
model.in = [1]; // it's only z,
//it has at first position occupies which means at first position is 1, 1 indicates that only one input value, see wriiten notes to understand
model.in2 = [1]; // the second dimension of I/P whcih means all the data enter has one dimension data for example just z axis data while if it was 2 than we have input data of x and y if there is 3 then x,y,z so on. each column represents specific data
model.intyp = 1;
// One output with a single "double" element
model.out = [2; 2];
model.out2 = [1; 2];
model.outtyp = 1;
// Set initial state
model.state = [Initial_state; matrix(covariance_matrix, 4, 1)]; // Use the matrix concatenation function
// For example: [initial_state; initial_covariance(:)]
// Set default parameter
model.rpar = covariance_matrix; // Use the covariance matrix as a parameter
// Define block properties
model.blocktype = 'c';
model.dep_ut = [%t %f]; // what does %t and %f indicates?
// Set block properties
exprs = ["[0.0; 0.0]"; "[1.0]"]; // How do we get this value?
x = standard_define([4 4], model, exprs);
x.graphics.style = ["blockWithLabel;displayedLabel=Kalman_Filter"];
//other cases other than set or define sections
end
endfunction
Does anyone know what is the error in the syntax? I am trying to debug it?