如何从椭圆度 matlab,怎么在【MATLAB】画圆和椭圆

%圆和椭圆都是0到360°极角乘上极径来控制的图形

%当x,y方向极径相同时画出的就是圆

%当x,y方向极径不同时画出的就是椭圆

%圆心(x0,y0);半径(a,b);

%旋转可以有两种方式:

%1、仅改变角度旋转,那么图形形状会发生改变

%2、利用坐标轴旋转原理,图形形状不会改变

clear;

% the center of circle/ellipse

x0=0;

y0=0;

theta=0:pi/100:2*pi; %

angle:0 to 2*pi

a=10; %

radius of X axis

b=5;%

radius of Y axis

% parametric expression of circle/ellipse

x=a*cos(theta)+x0;

y=b*sin(theta)+y0;

figure;plot(x,y);axis([-15 15 -15 15]);

%1st kind rotation

% the radius will have a clockwise rotation of lamda(angle)

% but the circle/ellipse also will be changed

% when lamda=n*pi/2,the plot will become a line

lamda=pi/4;

x1=a*cos(theta+lamda)+x0;

y1=b*sin(theta)+y0;

figure;plot(x1,y1);axis([-15 15 -15 15]);

%2nd kind rotation

% how to keep the shape of circle/ellipse when rotating axis?

% consider axis rotation relationship

% the shape will not be changed using this method

x2=x*cos(lamda)+y*sin(lamda);

y2=-x*sin(lamda)+y*cos(lamda);

figure;plot(x2,y2);axis([-15 15 -15 15]);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值