---
title: "Friction Models"
language: "en"
type: "Example"
summary: ""
keywords: 
- differential equations
- solving differential equations
- differential equation solving
- working with differential equations
- differential equations with events
- solving differential equations with events
- solve differential equations with events
- solve differential equations events
- events with differential equations
- differential equations events
- differential equations events solving
- hybrid and differential equations
- differential and hybrid equations
- solving hybrid and differential equations
- solving differential and hybrid equations
- differential and hybrid equation solving
- differential algebraic equations
- differential-algebraic equations
- solve differential algebraic equations
- solve differential-algebraic equations
- solving differential algebraic equations
- solving differential-algebraic equations
- differential algebraic equation solving
- differential-algebraic equation solving
canonical_url: "https://reference.wolfram.com/language/example/FrictionModels.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Differential Equations"
    link: "https://reference.wolfram.com/language/guide/DifferentialEquations.en.md"
  - 
    title: "Differential Equations with Events"
    link: "https://reference.wolfram.com/language/guide/DifferentialEquationsWithEvents.en.md"
---
# Friction Models

Model a block on a moving conveyor belt anchored to a wall by a spring, using different models for the friction force $F_f$. Compare positions and velocities for the different models. This model incorporates four types of friction: viscous, Coulomb, Stribeck, and static.

---

[image]

```wl
In[1]:=
m = l = 1.;
beltv[t_] = .1;
spring[x_] = 1000.(l - x);
```

*Viscous friction* is proportional to the relative velocity $F_{\text{visc}}=-\alpha  v$ :

```wl
In[4]:= sys := {m x''[t] == spring[x[t]] + friction[x'[t]], x[0] == 1, x'[0] == 0};

In[5]:=
viscous[v_] := -30.(v - beltv[t]);
friction[v_] := viscous[v];

In[7]:= {pos1, vel1} = NDSolveValue[sys, {x, x'}, {t, 0, 2}];
```

The block quickly settles in a stable position:

```wl
In[8]:= GraphicsRow[{Plot[{pos1[t]}, {t, 0, 1}, AxesLabel -> {"t", "x"}, PlotRange -> All], Plot[{vel1[t], beltv[t]}, {t, 0, 1}, AxesLabel -> {"t", "v"}, PlotRange -> All]}, ImageSize -> 500]

Out[8]= [image]
```

*Coulomb friction* is proportional to the sign of relative velocity $F_{\text{coul}}=\beta  \text{sgn}(v)$ :

```wl
In[9]:=
coulomb[v_] := -25.Sign[v - beltv[t]];
friction[v_] := viscous[v] + coulomb[v];

In[11]:= {pos2, vel2} = NDSolveValue[sys, {x, x'}, {t, 0, 20}];
```

With the addition of Coulomb friction, the block initially sticks to the belt before settling down:

```wl
In[12]:= GraphicsRow[{Plot[{pos2[t]}, {t, 0, 1}, AxesLabel -> {"t", "x"}, PlotRange -> All], Plot[{vel2[t], beltv[t]}, {t, 0, 1}, AxesLabel -> {"t", "v"}, PlotRange -> All]}, ImageSize -> 500]

Out[12]= [image]
```

*Stribeck friction* is a refined Coulomb friction $F_{\text{str}}=\gamma  \text{sgn}(v) e^{-2 | v| }$ :

```wl
In[13]:=
stribeck[v_] := -.3Sign[v]Exp[-2Abs[v]];
friction[v_] := viscous[v] + coulomb[v] + stribeck[v];

In[15]:= {pos3, vel3} = NDSolveValue[sys, {x, x'}, {t, 0, 20}];
```

The relative effect of Stribeck friction in the model is small:

```wl
In[16]:= GraphicsRow[{Plot[{pos3[t]}, {t, 0, 1}, AxesLabel -> {"t", "x"}, PlotRange -> All], Plot[{vel3[t], beltv[t]}, {t, 0, 1}, AxesLabel -> {"t", "v"}, PlotRange -> All]}, ImageSize -> 500]

Out[16]= [image]
```

*Static friction* holds the block in place until the spring force exceeds some value $\mu$, depending on the roughness of the surfaces:

```wl
In[17]:= friction[v_] := viscous[v] + coulomb[v] + stribeck[v];

In[18]:= staticsys := {x''[t] == If[stuck[t] == 1, beltv'[t], spring[x[t]] + friction[x'[t]]], x[0] == 1, x'[0] == 0};

In[19]:=
μ = 100;
stick = WhenEvent[x'[t] == beltv[t], stuck[t] -> Boole[spring[x[t]]^2 < μ^2]];
slip = WhenEvent[spring[x[t]]^2 > μ^2, stuck[t] -> 0];

In[22]:= {pos4, vel4} = NDSolveValue[{staticsys, stick, slip, stuck[0] == 0}, {x, x'}, {t, 0, 8}, DiscreteVariables -> stuck[t]];
```

The block repeatedly sticks to the belt due to frictional forces and then slips back due to the spring force:

```wl
In[23]:= GraphicsRow[{Plot[{pos4[t]}, {t, 0, 8}, AxesLabel -> {"t", "x"}, PlotRange -> All], Plot[{vel4[t], beltv[t]}, {t, 0, 8}, AxesLabel -> {"t", "v"}, PlotRange -> All]}, ImageSize -> 500]

Out[23]= [image]
```

Compare the successively refined friction models:

```wl
In[24]:= Plot[{pos1[t], pos2[t], pos3[t], pos4[t]}, {t, 0, 2}, AxesLabel -> {"t", "x"}, PlotRange -> {0.9, 1.1}, PlotLegends -> {"viscous", "viscous+Coulomb", "viscous+Coulomb+Stribeck", "viscous+Coulomb+Stribeck+static"}, ImageSize -> 300]

Out[24]= [image]
```

## Related Guides

* [Differential Equations](https://reference.wolfram.com/language/guide/DifferentialEquations.en.md)

* [Differential Equations with Events](https://reference.wolfram.com/language/guide/DifferentialEquationsWithEvents.en.md)