Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: draw a parabola with given angle
Date: Tue, 8 May 2012 20:09:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <jobuh6$kpd$1@newscl01ah.mathworks.com>
References: <job58v$lg1$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1336507750 21293 172.30.248.47 (8 May 2012 20:09:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 8 May 2012 20:09:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:767241

"niloufar " <ndarvish@kth.se> wrote in message <job58v$lg1$1@newscl01ah.mathworks.com>...
> does anybody know how to draw a Parabola with given phi(angle of the detected parabola in polar coordinates) and  p  ( distance between vertex and focus of the detected  parabola) in Cartesian coordinate system ? 
- - - - - - - - - -
  If the parabola's focal point is assumed to be at the origin of the cartesian coordinates and if the directrix is parallel to the y-axis and left of it, the polar coordinate equation of the parabola is

 r = 2*p/(1-cos(t))

for the p you defined where r and t (theta) are the polar coordinates.  If the directrix is rotated an angle t0, the equation becomes

 r = 2*p/(1-cos(t-t0))

  If you simply want to plot a portion of it, do this:

 t = linspace(t0+k,t0+2*pi-k);
 r = 2*p./(1-cos(t-t0));
 x = r.*cos(t);
 y = r.*sin(t);

where k>0 is chosen according to how large your plot is to be.  (As Bruno humorously indicated, with k = 0 so as to encompass the entire parabola, it would be of infinite extent and therefore wouldn't fit on your monitor.)

  If the origin is not at the focal point, then change the last two equations to:

 x = r.*cos(t) + x0;
 y = r.*sin(t) + y0;

where (x0,y0) is the location of the focal point.

  If you want an equation in cartesian coordinates for such a parabola, use algebra to convert the above polar equation to cartesian form.  (It isn't really very hard to do.)

Roger Stafford