help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Circle looks like ellipse


From: Aziz YÜCELEN
Subject: Circle looks like ellipse
Date: Thu, 25 Jul 2019 12:19:09 +0000

Hi 

I want to plot a simple tear drop-like a function.  I have a problem while plot screen. Circle looks like ellipse so that  X and Y axis scale not equal. Full code is below. Please can you help me ? 

***********************************************
%circle center: (center_x,center_y)
%circle radius:radius
y axis component of any top point
% (x1,y1)->(x2,y2)<-(x3,y3)
%
function tear_drop(center_x,center_y,radius,top_y_point)
th = linspace( pi, (2*pi), 100);
R = radius/2;  %or whatever radius you want
x = R*cos(th)+center_x;
y = R*sin(th)+center_y;
x1=center_x-(R);
x2=center_x;
x3=center_x+(R);
y1=y3=0;
y2=top_y_point;
plot([x1 x2], [y1 y2],'r')
hold on
plot([x2 x3], [y2 y3],'r')
hold on
plot(x,y,'k');
hold on
endfunction
*******************************************

reply via email to

[Prev in Thread] Current Thread [Next in Thread]