matlab实现矩阵的旋转变换

  • 以原点为中心,逆时针旋转角度 θ \theta θ
    x ′ = r c o s ( θ + ϕ ) = r c o s θ c o s ϕ − r s i n θ s i n ϕ = x c o s θ − y s i n θ y ′ = r s i n ( θ + ϕ ) = r s i n θ c o s ϕ + r c o s θ s i n ϕ = x s i n θ + y c o s θ x'=rcos(\theta+\phi)=rcos\theta cos\phi-rsin\theta sin\phi=xcos\theta-ysin\theta \\ y'=rsin(\theta+\phi)=rsin\theta cos\phi+rcos\theta sin\phi=xsin\theta+ycos\theta x=rcos(θ+ϕ)=rcosθcosϕrsinθsinϕ=xcosθysinθy=rsin(θ+ϕ)=rsinθcosϕ+rcosθsinϕ=xsinθ+ycosθ
  • d e t ( A ) = 1 det(A)=1 det(A)=1旋转后图形面积不变
    A = [ c o s θ − s i n θ s i n θ c o s θ ] A=\begin{bmatrix} cos\theta & -sin\theta\\ sin\theta & cos\theta \end{bmatrix} A=[cosθsinθsinθcosθ]
    在这里插入图片描述
x1 = [0;0];
x2 = [1;0];
x3 = [1;1];
x4 = [0;1];
x = [x1,x2,x3,x4,x1];
A = [0.866 -0.5;0.5 0.866];
y = A * x;
plot(x(1,:),x(2,:), 'b')
hold on
plot(y(1,:),y(2,:),'r')
axis([-1 1.5 0 1.5])
grid on
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值