How can I stop errors in Simulink and Simscape?
1 view (last 30 days)
Show older comments
Hello eveyone,
I am trying to build an basketball shooting arm model with simscape. I got motion capture data and I am trying to create the model according to motion capture motion. To do this I have to optimize 42 parameters and I am using Simulated Annealing Algorithm to optimize them. Everything is ready but I got a problem.
Line 118 runs the simularion and at the end of the simulation, Line 120 gives me the simularion results as a matrix.
My code is like that:
%% .... blah blah blah .....
118- sim('basketball_shooting_simulation.slx')
119
120-out_table= [ans.out_shoulder.time,ans.out_shoulder.signals.values,ans.out_elbow.signals.values,ans.out_wrist.signals.values];
121-assignin('base','ans',ans)
122-t_s=(0:0.004:0.312);
123-angle_results = out_table(ismembertol(out_table(:,1),t_s),:);
124-assignin('base','angle_results',angle_results)
%% after this step bring the results to comparison function .....
When I start the optimization program, it runs several times and it stops immediately because of the simscape errors like:
An error occurred while running the simulation and the simulation was terminated
Caused by:
- Derivative of state 'basketball_shooting_simulation.Basketball_Shooting_Arm_Model.shoulder_joint.Rz.w' in block 'basketball_shooting_simulation/Basketball Shooting Arm Model/shoulder joint' at time 0.220275 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
As we can understand here I don't want to use this run's parameters and optimization must be continue but it is not. After this error everything stops immediately.
How can I get the lastes results of simulation without errors and continue the optimization?
I would be appeciate I you can help me.
0 Comments
Answers (0)
See Also
Categories
Find more on Multibody Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!