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

  • Thread starter btbam91
  • Start date
  • #1
91
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 lets 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.
 

Answers and Replies

  • #2
249
2


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!
 
  • #3
272
0


Place an if statement such that if y=0, then x=0.
 
  • #4
jhae2.718
Gold Member
1,161
20


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.
 

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

  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
3
Views
6K
  • Last Post
Replies
3
Views
3K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
5
Views
2K
Replies
1
Views
5K
  • Last Post
Replies
1
Views
900
Replies
1
Views
2K
  • Last Post
Replies
10
Views
10K
Top