How do I plot an arc or parabola

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

Antworten (2)

Are Mjaavatten
Are Mjaavatten am 30 Dez. 2015
Bearbeitet: Walter Roberson am 30 Dez. 2015

0 Stimmen

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')

Kategorien

Mehr zu Line Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 19 Nov. 2015

Beantwortet:

am 30 Dez. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by