Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 17 15:51:35 2020
@author: Nolte
"""
import numpy as np
from matplotlib import pyplot as plt
plt.close('all')
print('logistic.py')
# model_case 1 = logistic
# model_case 2 = cosine
# model_case 3 = cubed
model_case = int(input('Enter the Model Case (1-3)'))
if model_case == 1:
ming = 2.9
maxg = 4.0
grep = 900
ymin = 0
ymax = 1
xold = 0.231
def logis(g,xin):
xout = g*xin*(1.0-xin)
return xout
elif model_case == 2:
ming = 1
maxg = 10
grep = 900
ymin = -1.2
ymax = 1.2
xold = 0.231
def logis(g,xin):
xout = np.cos(g*xin)
return xout
else:
ming = 1
maxg = 3
grep = 900
xold = 0.231
def logis(g,xin):
xout = g*xin*(1-xin**2)
return xout
rep = 64;
plt.figure(1)
plt.axes(xlim=(ming, maxg), ylim=(ymin, ymax))
for gainloop in range(grep):
g=(maxg-ming)*gainloop/grep + ming;
for sloop in range(100): # settle-down loop
xnew = logis(g,xold)
xold = xnew
x = np.zeros(shape = (rep))
y = np.zeros(shape = (rep))
ind = 0
for rloop in range(rep-1):
xnew = logis(g,xold)
xold = xnew
ind = ind + 1
x[ind] = g + (maxg-ming)*(rloop-1)/(grep*rep);
y[ind] = xnew;
lines = plt.plot(x,y,'o',ms=1)
plt.pause(0.05)
plt.show()