CODING HELP PLEASE I have no idea what kind of function I need using Python Part
ID: 3742213 • Letter: C
Question
CODING HELP PLEASE
I have no idea what kind of function I need using Python
Part 1: Create a function that will simulate the falling ball until it hits the ground and will plot the results. This function should take two parameters as required input, and it should take the other parameters as option input (with appropriate default values). The two parameters that should be given as required input are: The maximum time (in seconds) to be simulated The value of the time step, At. From these two numbers, you can compute the (integer) number of times steps to be simulated, N. When executed, this function should plot both height versus time and velocity versus time. Each plot should contain two datasets: the analytical results, and the numerical results. All of the computed data should be store in arrays, which can be constructed by either repeatedly appending data to the arrays or using array indices (square brackets). When plotting, the arrays will be needed in order to (1) plot the data with connecting lines and (2) create a legend. In order to clearly see each of the datasets in the plots, you might need to play with the "linewidth" property in the plots. As always, be sure your plots are nicely formatted!Explanation / Answer
import matplotlib.pyplot as plt
def PLOT_DATA(T,dt):
v=2.5;
theta=45;
N=math.ceil(T/dt);
y=[];
for time in range(0,N):
height=(v*(time*dt)*sin())-((1/2)*g*(time*dt)^2);
y.add(height);
plt.plot(range(0,N),y,color='green',linestyle='dashed',linewidth=4,marker='0',markerfacecolor='blue', markersize=12);
PLOT_DATA(0.2,20);
You add the formula for calculating velocity and height, for height calculation i filled the formula, but for velocity, you search or read your theory part then add it, then also add in plot, Hope this will help you, thanks
pleas egive thumbs up, thanks
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.