Artifact 030265f1887e0ed7d92241bd3979c19af8a22c1b3436a2e51111035b273450c5:



## Set up parameters
name = "idInvertedPendulumOnCart";
sim = sidInvertedPendulumOnCart_simpar;		# Simulation parameter
sym = sidInvertedPendulumOnCart_sympar;		# Parameter names
par = sidInvertedPendulumOnCart_numpar;		# Parameter values
x0  = sidInvertedPendulumOnCart_state(par);         # Initial state

## Simulation of "actual" system
t = [0:sim.dt:sim.last]';
one = ones(size(t));
u = 1.0*(t<one);
y_0 = sidInvertedPendulumOnCart_ssim(x0,par,sim,u);

## Initial parameter
par_0 = par;
par_0(sym.r_c) = 0.0;
par_0(sym.r_p) = 0.0;

## Identify
extras.criterion = 1e-5;
extras.max_iterations = 10;
extras.v = 1e-5;
extras.verbose = 1;		# Show what is going on
[par,Par,Error,Y] = ppp_identify (name,u,y_0,["r_c";"r_p"],par_0,extras);

par = par

grid;
xlabel("Time")
title("Estimated output");
plot(t,y_0,t,Y);
figfig("idInvertedPendulumOnCart_outputs","pdf");
figfig("idInvertedPendulumOnCart_outputs","ps");

xlabel("Iteration")
title("Estimation error");
plot(Error);
figfig("idInvertedPendulumOnCart_error","pdf");
figfig("idInvertedPendulumOnCart_error","ps");

xlabel("Iteration")
title("Estimated Parameters");
plot(Par([sym.r_c,sym.r_p],:)');
figfig("idInvertedPendulumOnCart_parameters","pdf");
figfig("idInvertedPendulumOnCart_parameters","ps");







MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]