How do I plot an arc or parabola
7 views (last 30 days)
Show older comments
I just started learning matlab and I have found plotting an arc and parabola very difficult no matter how hard I read previously posted questions about it. Here is a picture of what I wanna try to plot with the arcs hand drawn using paint. However am gonna use one side as an example (the parabola in red). My start point=[2,10], critical point=[4,9], end point=[5,10]. Thank you

0 Comments
Answers (2)
Are Mjaavatten
on 30 Dec 2015
Edited: Walter Roberson
on 30 Dec 2015
If I read you correctly, you want a parabola that goes through the three specified points and that additionally has a horizontal tangent at the middle point. This is a parabola with a tilted axis, and I do not have the patience to work out the formulas. However, if you can make do with parabolas with vertical or horizontal axes, polyfit will give you the parameters you need. For symmetry, I have moved the middle point to 3.5:
x1 = [2,3.5,5];
y1 = [10,9,10];
x1plot= linspace(2,5);
p = polyfit(x1,y1,2);
y1plot = polyval(p,x1plot);
plot(x1plot,y1plot,'r');
% Horizontal axis for the arc on the lower left:
hold on
x2 = [2,1.7,2];
y2 = [11,12,13];
p2 = polyfit(y2,x2,2);
y2plot = linspace(11,13);
x2plot = polyval(p2,y2plot);
plot(x2plot,y2plot,'k')
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!