Forked from addisoneee/Piecewise Function in Python
Created
November 7, 2016 15:50
-
-
Save aryamanarora/73ecc3423f7e359208ad79c32c527a71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
def fun(x): | |
#This is where all the info on the function goes | |
if x < 28: | |
return 100000*x - 2721000 | |
else: | |
return 79000 | |
vfun = np.vectorize(fun) | |
x = np.linspace(27,29) | |
y = vfun(x) | |
plt.axis([27,29,-25000,90000]) | |
plt.plot(x,y,'-') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment