Content

## Input parameters of 2-D ellipse

clc, clear, close all x0 = 3; y0 = 3; % Center of ellip a = 2; b = 1; % Major and minor radius phi = 30; % Orientation (degree) num = 100; % #points -> smoothness

## draw 'ellip = scaled circle' at origin

theta = linspace(0,2*pi,num); p(1,:) = a*cos(theta); p(2,:) = b*sin(theta); figure(1), hold on plot(p(1,:),p(2,:),'k--','LineWidth',2) axis equalRotate to derised angle

phi = phi*pi/180; % deg->rad % Rotation matrix: Q = [cos(phi) -sin(phi) sin(phi) cos(phi)]; p = Q*p; plot(p(1,:),p(2,:),'g--','LineWidth',2) plot(0,0,'r+')Move to derised location

p(1,:) = p(1,:) + x0; p(2,:) = p(2,:) + x0; plot(p(1,:),p(2,:),'LineWidth',2) plot(x0,y0,'r+')

## 4 comments:

Why do you show your know how like this? should keep them somewhere :)

Partly because I am not sure where is somewhere, so just place here.

By the way, one might found it helps, other don't- (and I am happy with this :))

Yes this is helpful for me

This is amazing! I was looking how to move to a specific location for long. Thank you very very much. Only one correction in the p(2,:) for the devised location. It is:

p(1,:) = p(1,:) + x0;

p(2,:) = p(2,:) + y0;

Many thanks!!

Post a Comment