Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Ellipe drawing
Replies: 2   Last Post: Jun 21, 2013 6:06 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 5,688
Registered: 2/7/05
Re: Ellipe drawing
Posted: Jun 21, 2013 6:06 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 6/21/2013 4:35 PM, TideMan wrote:

>
> Here's an alternative for an ellipse with major axis qmax and minor axis qmin, centre at x0,y0, and orientated theta deg from N.
> function [x,y]=ellipse(qmax,qmin,theta,x0,y0,n)
> %
> % Set up parameters
> %
> theta=theta*pi/180; % Orientation from N
> wt=0:n; % n is no of points 180 is good
> dwt=2*pi/n;
> wt=wt'*dwt;
> sth=sin(theta);
> cth=cos(theta);
> %
> % Calculate ellipse with zero orientation
> %
> x1=qmax*cos(wt);
> y1=qmin*sin(wt);
> %
> % Orientate theta deg from north
> %
> x=x1*sth-y1*cth+x0;
> y=x1*cth+y1*sth+y0;
>
> plot(x,y)
>


And if one is adventurous and want to do the plotting in Latex, see

http://www.texample.net/tikz/examples/node-shapes/

for many examples

--Nasser





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.