MATLAB Answers

## stiffness problem / Trying to use ode1 (Euler) in Simulink

Asked by Morten

### Morten (view profile)

on 22 May 2012

Hi.

I am trying to simulate a robot manipulator in Simulink. Unfortunately, the simulation system I have made will not run unless I use the ode15s (stiff) solver. This probably indicates that my system is stiff, but according to my professor, it's not supposed to be. He says that I should be able to simulate the system using ode1 with fixed step of 0.001 for instance.

He also though that the system behaved in this way due to the matrix inverse. I was using inv(D) within a level-2 s-function. I have now changed that to D\eye(6), but with no immediate effect.

I need to figure out how to do this because I also need to copy the system into LabVIEW and LV don't have the ode15s solver.

Does anybody have a clue to what the problem can be, or how to solve it? I'm really struggling here.

## 1 Answer

### Guy Rouleau (view profile)

Answer by Guy Rouleau

### Guy Rouleau (view profile)

on 22 May 2012

I would verify if the robot starts in a singular configuration.

If you invert D, I guess this is because D is the manipulator jacobian. What is the condition number of the jacobian? Try cond(D) or eig(D). If MATLAB returns a warning about the matrix being badly conditionned, try another configuration.

Other that that... what error message your receive when trying to simulation with ode1 and ts=0.001 ?

When using ode15s, what is the step size taken by the solver? You can determine that by logging the simulation time and plotting diff(tout).

Morten

### Morten (view profile)

on 26 May 2012

D is the manipulator inertia matrix (referred to as M, H, or D, depending on litterature). The equation I am trying to simulate looks like this: (qdd = q double dot, qd = q dot..)
D(q)qdd + C(q,qd)qd + G(q) = tau.

Tau is set to be zero, thus I am simulating a manipulator collapsing to gravity.

I tried cond(D), eig(D), cond(Dinv), eig(Dinv), but none of them gave any error messages.

The error message says that the derivative input of the first integrator is either INF of NAN. "There may be a singularity to the problem".

When using ode15s, the step size in the beginning is very small.

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

New to MATLAB?