Untitled

 avatar
unknown
plain_text
a year ago
402 B
2
Indexable
import matplotlib.pyplot as plt

# Define the function
def f(x):
    return 0.3 * (x - 4)

# Define the x values
x = [0, 1, 2, 3, 4, 5]

# Calculate the y values
y = [f(i) for i in x]

# Plot the function
plt.plot(x, y, 'ro-')

# Set the x and y limits
plt.xlim(0, 5)
plt.ylim(-1, 1)

# Set the x and y labels
plt.xlabel('x')
plt.ylabel('0.3(x - 4)')

# Show the plot
plt.show()
Leave a Comment