model(...) command for simscape multipbody models
Mostrar comentarios más antiguos
What is the correct way of setting the evaluation point in the model(...) command? I plan to evaluate time derivatives of a simmechanics (simscape multibody) model at various states. The documentation states that the second argument is the state, but the output appears to be independent from the state. A minimal example:
%%test mdlapi on mech_dpen
clear
open('mech_dpen'); % open double pendulum example
vm = mech_stateVectorMgr('mech_dpen/Ground');
xini=mech_set_states(vm)'; % example of state (=[0,0,...])
nstates=length(xini); % called nstates
xtest=xini(ones(nstates,1),:)+eye(nstates); % array of perturbations
%%Compile model using mdlapi and evaluate derivatives in perturbations
[sys,x0,str,ts] = mech_dpen([],[],[],'compile');
for i=nstates:-1:1
dxdt(i,:)=mech_dpen(0,xtest(i,:),[],'derivs');
end % dxdt are all 0
mech_dpen([],[],[],'term');
This results in all dxdt equal to exactly zero[*], while according to documentation it should return the time derivatives in xtest(i,:). Am I using the interface wrongly? I plan to use this interface to call a model (more complicated, with loop topology) in my own optimization/parameter continuation routines.
Version of matlab used:
>> ver
MATLAB Version: 8.4.0.150421 (R2014b)
...
Operating System: Linux 2.6.32-431.20.3.el6.x86_64 #1 SMP Thu Jun 19 14:01:59 CDT 2014 x86_64
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
[*] Note that it also gives warnings. I get the same result, when I feed in a structure as second argument of mech_dpen(...).
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Simulation and Analysis en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!