How do I plot an arc or parabola
7 ビュー (過去 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

0 件のコメント
回答 (2 件)
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')
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!