Quick MATLAB help -> Setting a termination point on a plot.

AI Thread Summary
To set a termination point on a MATLAB plot for a kinematics problem, users can limit the plotted data by adjusting the dataset to exclude values below zero. One method is to use an if statement to stop calculations when the position reaches zero. Alternatively, users can slice the data vector to remove nonsensical values, ensuring only relevant points are plotted. Adjusting the axis length can also help in hiding unwanted data points. Implementing these strategies will effectively prevent the plot from displaying values below the desired threshold.
btbam91
Messages
91
Reaction score
0
Quick MATLAB help --> Setting a termination point on a plot.

I have this kinematics problem on dropping a ball from a building a few meters high. When I plot the position vs time graph, it starts at let's say 50 meters high, I get a plot of an upside down parabola, as expected, but my plot continues down below 0. Is there a way to tell MATLAB to stop calculating/plotting values when x=0?

Thanks.
 
Physics news on Phys.org


It will plot all the data points you give it... so give it less data points if some are nonsensical or change the axis length to cut them out of view!
 


Place an if statement such that if y=0, then x=0.
 


Sometimes I'll iterate through the results and slice the vector where the absolute value of the i-th element subtracted from zero is less than some epsilon. Not particularly elegant, but it works.
 
Thread 'Have I solved this structural engineering equation correctly?'
Hi all, I have a structural engineering book from 1979. I am trying to follow it as best as I can. I have come to a formula that calculates the rotations in radians at the rigid joint that requires an iterative procedure. This equation comes in the form of: $$ x_i = \frac {Q_ih_i + Q_{i+1}h_{i+1}}{4K} + \frac {C}{K}x_{i-1} + \frac {C}{K}x_{i+1} $$ Where: ## Q ## is the horizontal storey shear ## h ## is the storey height ## K = (6G_i + C_i + C_{i+1}) ## ## G = \frac {I_g}{h} ## ## C...
Back
Top