# let solution settle
    transient = fhn.compute('trans')
    fhn.set(ics=transient(10),
            tdata=[0,20])

    # More of your code here


# Your code here for the frequency plot



1/0  # comment this to apply phase plane picture to whatever
# are the current parameters of FHN model

## Optional code

fp_coord = pp.find_fixedpoints(fhn, n=25, eps=1e-6)[0]
fp = pp.fixedpoint_2D(fhn, Point(fp_coord), eps=1e-6)

nulls_x, nulls_y = pp.find_nullclines(fhn, 'x', 'y', n=3, eps=1e-6,
                                      max_step=0.1, fps=[fp_coord])
plt.figure(3)
pp.plot_PP_fps(fp)
plt.plot(nulls_x[:,0], nulls_x[:,1], 'b')
plt.plot(nulls_y[:,0], nulls_y[:,1], 'g')

plt.show()

Exemple #2
0
# only one fixed point, hence [0] at end.
# n=4 uses three starting points in the domain to find any fixed points, to an
# accuracy of eps=1e-8.
fp_coord = pp.find_fixedpoints(vdp, n=4, eps=1e-8)[0]
fp = pp.fixedpoint_2D(vdp, dst.Point(fp_coord), eps=1e-8)

# n=3 uses three starting points in the domain to find nullcline parts, to an
# accuracy of eps=1e-8, and a maximum step for the solver of 0.1 units.
# The fixed point found is also provided to help locate the nullclines.
nulls_x, nulls_y = pp.find_nullclines(vdp, 'x', 'y', n=3, eps=1e-8,
                                      max_step=0.1, fps=[fp_coord])


# plot the fixed point
pp.plot_PP_fps(fp)

# plot the nullclines
plt.plot(nulls_x[:,0], nulls_x[:,1], 'b')
plt.plot(nulls_y[:,0], nulls_y[:,1], 'g')

# plot the trajectory
plt.plot(pts['x'], pts['y'], 'k-o', linewidth=2)

# plot the event points
plt.plot(evs['x'], evs['y'], 'rs')

plt.axis('tight')
plt.title('Phase plane')
plt.xlabel('x')
plt.ylabel('y')