How do I plot an arc or parabola

조회 수: 7 (최근 30일)
peter obi
peter obi 2015년 11월 19일
답변: Image Analyst 2015년 12월 30일
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

답변 (2개)

Are Mjaavatten
Are Mjaavatten 2015년 12월 30일
편집: Walter Roberson 2015년 12월 30일
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')

Image Analyst
Image Analyst 2015년 12월 30일
FAQ entry for creating a circular arc: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_an_arc.3F

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by