annotate toolboxes/FullBNT-1.0.7/KPMtools/plot_ellipse.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 % PLOT_ELLIPSE
Daniel@0 2 % h=plot_ellipse(x,y,theta,a,b)
Daniel@0 3 %
Daniel@0 4 % This routine plots an ellipse with centre (x,y), axis lengths a,b
Daniel@0 5 % with major axis at an angle of theta radians from the horizontal.
Daniel@0 6
Daniel@0 7 %
Daniel@0 8 % Author: P. Fieguth
Daniel@0 9 % Jan. 98
Daniel@0 10 %
Daniel@0 11 %http://ocho.uwaterloo.ca/~pfieguth/Teaching/372/plot_ellipse.m
Daniel@0 12
Daniel@0 13 function h=plot_ellipse(x,y,theta,a,b)
Daniel@0 14
Daniel@0 15 np = 100;
Daniel@0 16 ang = [0:np]*2*pi/np;
Daniel@0 17 R = [cos(theta) -sin(theta); sin(theta) cos(theta)];
Daniel@0 18 pts = [x;y]*ones(size(ang)) + R*[cos(ang)*a; sin(ang)*b];
Daniel@0 19 h=plot( pts(1,:), pts(2,:) );