Warning and error: SIP Warning: There are more output channels in the data object than samples. Check if the output data matrix should be transposed. > In warning at 26 In @iddata\private\datachk at 35 In iddata.iddata at 192 In SIP at 10 Warning: There are more output channels in the data object than samples. Check if the output data matrix should be transposed. > In warning at 26 In @iddata\private\datachk at 35 In iddata.pvset at 138 In iddata.set at 143 In iddata.iddata at 227 In SIP at 10 ipfd Error using iddata (line 229) The number of elements in the "OutputUnit" property value must be equal to the number of output channels. Use a cell array of 1000000 string(s).
Error in SIP (line 10) sway = iddata(O, [], 0.001, 'Name', 'Sway', 'OutputUnit', 'rad');
Error using ipfd (line 34) Not enough input arguments.
load('O');
sway = iddata(O, [], 0.001, 'Name', 'Sway', 'OutputUnit', 'rad');
set(sway, 'Tstart', 0, 'TimeUnit', 's');
load('r');
leg = iddata(r, [], 0.001, 'Name', 'Leg length', 'OutputUnit', 'm');
set(leg, 'Tstart', 0, 'TimeUnit', 's');
stab = load('stab');
g = stab(1);
set(g, 'OutputName', 'Gravity constant');
set(g, 'OutputUnit', 'm/s^2');
w0 = stab(2);
set(w0, 'OutputName', 'Initial angular velocity');
set(w0, 'OutputUnit', 'rad/s');
dt = stab(3);
set(dt, 'OutputName', 'Integration step');
set(dt, 'OutputUnit', 's');
m = stab(4);
set(m, 'OutputName', 'Weight');
set(m, 'OutputUnit', 'kg');
The next step is to create a generic IDNLGREY object for describing the pendulum. We also enter information about the names and the units of the inputs, states, outputs and parameters. Owing to the physical reality all model parameters must be positive and this is imposed by setting the 'Minimum' property of all parameters to the smallest recognizable positive value in MATLAB®, eps(0).
FileName = 'ipfd';
Order = [1 0 2];
Parameters = [g; w0; d; m];
InitialStates = [1; 0];
Ts = 0;
nlgr = idnlgrey(FileName, Order, Parameters, InitialStates, Ts);
set(nlgr, 'OutputName', {'Horizontal ground reaction force' 'Vertical ground reaction force' 'velocity' 'Horizontal position' 'Vertical position'}, ...
'OutputUnit', {'N' 'N' 'm/s' 'm' 'm'}, ...
'TimeUnit', 's');
nlgr = setinit(nlgr, 'Name', {'Sway' 'Leg length'});
nlgr = setinit(nlgr, 'Unit', {'rad' 'm'});
nlgr = setpar(nlgr, 'Name', {'Gravity constant' 'Integration step' ...
'Initial angular velocity' 'Mass'});
nlgr = setpar(nlgr, 'Unit', {'m/s^2' 's' 'rad/s' 'kg'});
nlgr = setpar(nlgr, 'Minimum', {eps(0) eps(0) eps(0) eps(0)});
nlgrrk45 = nlgr;
nlgrrk45.Algorithm.SimulationOptions.Solver = 'ode45';
nlgrrk45 = setpar(nlgrrk45, 'Fixed', {true true false true});
trk45 = clock;
nlgrrk45 = pem(z, nlgrrk45, 'Display', 'Full');
trk45 = etime(clock, trk45);
disp(' Estimation time Estimated value');
fprintf(' ode45: %3.1f %1.3f\n', trk45, nlgrrk45.Parameters(3).Value);
fpe(nlgrrk45);
figure
t = linspace(0, 1000, 1000000);
subplot(3,1,1);
plot(t,Fh)
subplot(3,1,2);
plot(t,Fv)
subplot(3,1,3);
plot(t,v)