I am trying to to a non linear grey box model identification and I am using the following code. I have my measurements for the input in input vector, output vector and time stamps in time.
input = output_data(2:3,:)';
output = output_data(4:5,:)';
time = output_data(1,:)';
data = iddata(output, input, [], 'SamplingInstants', time);
data.TimeUnit = 's';
%create model
Order = [2 2 4]; % Model orders [ny nu nx].cha
Parameters = [1; 1; 1; 1; 1; 0.1]; % Initial parameter vector.
InitialStates = [0; 0; 0; 0]; % Initial initial states.
nlgr_m = idnlgrey('vehicle_m', Order, Parameters, InitialStates);
setpar(nlgr_m, 'Fixed', {true true false false false false});
%Estimate the coefficients
sys = pem(data,nlgr_m, 'Display','Full', 'MaxIter', 20);
%get the parameters and the standard variation
[pvec,pvec_sd] = getpvec(sys)
I tried to use simulated input/outputs with known system parameters and the. However, the parameters that I get from this are very different from what it must be. Even when I set the initial parameter estimations It does not estimate the close parameters.
My time stamps are non-uniform which means the interval between every two sampling is not the same.
I would appreciate if anyone could help with this.