Plot parabola with start, end and vertex points
35 次查看(过去 30 天)
显示 更早的评论
Hi,
So I have three points and I would like matlab to plot them as a parabola. The points represent the path of a balls projectile motion and I know the start (0,0), end (2.062, 0) and high point (1.031, 0,73) of the parabola.
What I would like most would be to plot these points as a parabola and also calculate the equation for the parabola.
Thanks in advance :)
Freyja
0 个评论
采纳的回答
Roger Stafford
2013-11-11
Another way to get the parabola is to write:
y = 0.73-a*(x-1.031)^2
which is the form it must have to peak at (1.031,0,73) and then set x and y to zero to force the parabola to contain (0,0) and solve for a. The solution is obvious. Then do a plot.
更多回答(1 个)
Matt J
2013-11-11
编辑:Matt J
2013-11-11
You can use POLYFIT to fit a parabola to the points. Then you can use POLYVAL to sample and plot it.
4 个评论
Matt J
2013-11-11
But this gave me a triangle....not a parabola....
It only looks like a triangle, because you didn't plot at enough points
xu=linspace(0,2.06,1000);
plot(xu, polyval(p, xu));
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!