**MATLAB Code:**

The code algorithm of phase-plane diagram and Poincare' map are added at the end of this chapter. The code is done using MATLAB software and as in below:

```
clear; clc; close all
SignalName = '100rpm.dat';
signal = load(SignalName);
signal = signal - min(signal);
% Poincare map
% original D=signal; % Read data
[x1max,t1max] = findpeaks(D(:,1));
```
*Nonlinear Dynamics Phenomenon in a Polydyne Cam with an Offset Flat Faced Follower… DOI: http://dx.doi.org/10.5772/intechopen.106179*

**Figure 10.** *Follower displacement against time when the follower offsets to the right (O = 50 mm) at various cam speeds.*

## **Figure 11.**

*Follower displacement against time when the follower offsets to the left (O = 40 mm) at various cam speeds.*

```
Nmax = length(x1max); figure(1)
   subplot(1,2,1)
   for i=1:Nmax-1 plot(x1max(i),x1max(i+1),'ko','MarkerSize',5,'MarkerFa-
ceColor','k')
   hold on
   axis square
   xlabel('x_{max} '),ylabel('next x_{max}')
   grid on
   end
   %title('n = 100 rpm c = 1.5 mm') SignalName = '100rpmc2.dat';
   signal = load(SignalName);
   D = signal; % Read data
```

```
[x1max,t1max] = findpeaks(D(:,1));
   Nmax = length(x1max); subplot(1,2,2)
   for i=1:Nmax-1 plot(x1max(i),x1max(i+1),'ko','MarkerSize',5,'MarkerFa-
ceColor','k')
   hold on
   axis square
   xlabel('x_{max} '),ylabel('next x_{max}')
   grid on
   end
   %title('n = 100 rpm c = 2 mm') figure(2)
   aa = load('100rpm.dat');
   aa = aa - min(aa);
   plot(aa, gradient(aa));
```