Drawing hyperbola using patch function.

2 ビュー (過去 30 日間)
shane watson
shane watson 2017 年 5 月 17 日
コメント済み: shane watson 2017 年 5 月 24 日
I have to draw points in matlab which show trade-off (i.e, inversely relationship) for this reason I have to draw the hyperbola-like shape. I used the code shown below to draw points by using patch file now I need to hyperbola by using patch function.
% line([.1 .1 6 6 .1 .1],[.81 2.735 164 48.6 .81 2.735],'Marker','*','Color','k','LineStyle','-');
% line([4 4 6 6],[57 95 57 95],'Color','b','LineStyle','-');
patch([1.5 13.84 1.5],[13.8 1 288],'c','LineStyle','-')
%%%%%%%%%%%%%%%%P2 %%%%%%%%%%%%%%%%%%%%
x = [0.76 0.69];
y = [0.78 0.83];
annotation('textarrow',x,y,'String','P_{2}(29,405)')
% % %%%%%%%%%%%%%%%%%%%%P1 %%%%%%%%%%%%%%%
x = [0.65 0.60];
y = [0.47 0.55];
annotation('textarrow',x,y,'String','P_{1}(24,288)')
% % %%%%%%%%%%%%%P3%%%%%%%%%%%%
x = [0.76 0.69];
y = [0.60 0.65];
annotation('textarrow',x,y,'String','P_{3}(29,334)')
  6 件のコメント
shane watson
shane watson 2017 年 5 月 20 日
I have considered points on x-axis and y-axis to plot as shown in the code. Similarly, I have points to draw hyperbola. and I have no idea of area or syntax etc, as you have mentioned. Thank you, Walter Roberson.
Walter Roberson
Walter Roberson 2017 年 5 月 20 日
Are you looking for something that draws an area, or are you looking for something that draws a curved line?

サインインしてコメントする。

採用された回答

KSSV
KSSV 2017 年 5 月 19 日
%%hyperobola equation
% x^2/a^2-y^2/b^2=1
% hyperbola parameters
a = 1; b = 1;
% define the x-space
xmin = 5;
xmax = 5;
% convert in t-space
tmin = acosh(xmin/a);
tmax = acosh(xmax/a);
% hyperbola computation
t = linspace(-tmin,tmax,10);
x = a*cosh(t);
y = b*sinh(t);
% final plot
figure, set(gcf,'color',[1 1 1])
patch(x,y,'b')
hold on
patch(-x,y,'b')
  1 件のコメント
shane watson
shane watson 2017 年 5 月 24 日
Thank you KSSV for your help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by