当前位置:网站首页>Draw a red lantern with MATLAB
Draw a red lantern with MATLAB
2022-07-05 22:04:00 【slandarer】
PART.1 Code instructions
The space left this time is really too small , The logo is not painted well , If you have the ability, you can complete it by yourself , This time, the code still uses the ellipse data generation function , However, the difference is that this time the data points are constructed by the rotation matrix :
% Ellipse data point generating function
function [X,Y]=getEllipse(Mu,XR,YR,theta,pntNum)
% Mu | Center point
% XR,YR | Before the rotation X,Y Half shaft length
% theta | Rotation Angle
% pntNum | Number of generated data points
tList=linspace(0,2*pi,pntNum);
X=cos(tList).*XR;
Y=sin(tList).*YR;
rotateMat=[cos(theta),-sin(theta);sin(theta),cos(theta)];
XY=rotateMat*[X;Y]+Mu(:);
X=XY(1,:);Y=XY(2,:);
end
This code also uses various sinusoidal functions after rotation , Therefore, the last local function also contains a local function of rotating data .
% Data rotation angle
function [X,Y]=rotateData(X,Y,theta)
rotateMat=[cos(theta),-sin(theta);sin(theta),cos(theta)];
XY=rotateMat*[X;Y];
X=XY(1,:);Y=XY(2,:);
end
PART.2 Complete code
function xuerongrong
ax=gca;
ax.DataAspectRatio=[1 1 1];
ax.XLim=[-5 5];
ax.YLim=[-5 5];
hold(ax,'on')
% Draw the arm
[X,Y]=getEllipse([-1,-2.5],.4,.6,-pi/5,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.7,-1.89],.4,.6,pi/3.6,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
% Draw legs
rectangle('Position',[-.95,-4.2,1.3,1],'Curvature',.8,...
'FaceColor',[182,50,2]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
rectangle('Position',[-1,-3.9,1.4,1],'Curvature',.8,...
'FaceColor',[246,168,68]./255,'EdgeColor',[246,168,68]./255,'LineWidth',1.8)
rectangle('Position',[-1,-3.8,1.4,1],'Curvature',.8,...
'FaceColor',[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
rectangle('Position',[.5,-4.2,1.2,2],'Curvature',.8,...
'FaceColor',[182,50,2]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
rectangle('Position',[.45,-3.9,1.3,2],'Curvature',.8,...
'FaceColor',[246,168,68]./255,'EdgeColor',[246,168,68]./255,'LineWidth',1.8)
rectangle('Position',[.45,-3.8,1.3,2],'Curvature',.8,...
'FaceColor',[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
% Draw the body
rectangle('Position',[-.9,-3.5,2.6,3],'Curvature',.6,...
'FaceColor',[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
% Draw the head
[X0,Y0]=getEllipse([-.15,.65],2.9,2.3,pi/11,200);
fill(X0,Y0,[212,3,28]./255,'EdgeColor',[153,12,40]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-.15,.65],2.7,2.3,pi/11,200);
plot(X,Y,'Color',[236,136,74]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-.15,.65],1.7,2.3,pi/11,200);
plot(X,Y,'Color',[236,136,74]./255,'LineWidth',1.8)
X=linspace(0,pi,100);Y=sin(X);
X=X.*1.4;Y=Y.*0.2;
[X,Y]=rotateData(X,Y,-pi/11);
plot(Y+.41,X-1.46,'Color',[236,136,74]./255,'LineWidth',2)
plot(X0,Y0,'Color',[212,3,28]./255,'LineWidth',3)
% Draw clouds on your face
[X,Y]=getEllipse([-1.2,-.3],.5,.6,pi/3.4,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-1.3,.4],.45,.55,-pi/3.4,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-.65,1],.45,.7,-pi/4,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([0,1],.45,.7,-pi/4,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.8,.5],.4,.5,pi/5,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.63,.92],.4,.5,pi/12,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([.3,.25],1.6,1,pi/13,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([.95,1.42],.3,.3,pi/12,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
% Draw powder Blusher
[X,Y]=getEllipse([-1.1,-.5],.35,.35,pi/12,200);
fill(X,Y,[212,3,28]./255,'EdgeColor','none','FaceAlpha',.2)
[X,Y]=getEllipse([-1.1,-.5],.32,.32,pi/12,200);
fill(X+3,Y+.9,[212,3,28]./255,'EdgeColor','none','FaceAlpha',.2)
% Draw the eyes
[X,Y]=getEllipse([-.76,.16],.15,.24,pi/20,200);
fill(X,Y,[38,23,26]./255,'EdgeColor',[38,23,26]./255)
[X,Y]=getEllipse([1.25,.47],.15,.24,pi/20,200);
fill(X,Y,[38,23,26]./255,'EdgeColor',[38,23,26]./255)
[X,Y]=getEllipse([-.81,.21],.05,.05,pi/20,200);
fill(X,Y,[230,230,230]./255,'EdgeColor','none')
[X,Y]=getEllipse([1.2,.52],.05,.05,pi/20,200);
fill(X,Y,[230,230,230]./255,'EdgeColor','none')
% % Draw headdress
[X,Y]=getEllipse([-1.85,2.2],.48,.15,pi/20,200);
fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-.7,2.4],.47,.2,pi/15,200);
fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)
[X,Y]=getEllipse([.32,2.55],.47,.15,pi/15,200);
fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.2,2.6],.25,.14,pi/30,200);
fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)
%
[X,Y]=getEllipse([-1.8,2.1],.08,.2,-pi/10,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-.7,2.3],.08,.2,-pi/40,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
[X,Y]=getEllipse([.4,2.5],.08,.2,-pi/40,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.25,2.5],.04,.12,pi/10,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
% Paint golden moire
[X,Y]=getEllipse([-.3,3.6],.3,.35,pi/10-pi/5,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[246,168,68]./255,'LineWidth',2)
[X,Y]=getEllipse([-1,3.4],.3,.35,pi/10+pi/5,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[246,168,68]./255,'LineWidth',2)
[X,Y]=getEllipse([-.7,3.6],.35,.4,pi/10,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[246,168,68]./255,'LineWidth',2)
X=linspace(0+pi/10,pi-pi/10,200);
Y=sin(X);
X=X.*.4;Y=Y.*.3;
[X,Y]=rotateData(X,Y,pi/10);
plot(X-1.3,Y+3.2,'Color',[250,250,250]./255,'LineWidth',7)
% Draw a small hat
[X,Y]=getEllipse([0,0],1,.9,pi/12,200);Y=Y-.3;
Y(Y<=0)=Y(Y<=0).*.2;
[X,Y]=rotateData(X,Y,pi/14);
fill(X-.4,Y+2.8,[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
% Draw the snow on your head
X1=linspace(-2*pi/3,(5+2/3)*pi,200);
Y1=sin(X1);
X2=linspace(0,pi,200);
Y2=sin(X2);
X1=X1.*.22;Y1=Y1.*.1;
[X1,Y1]=rotateData(X1,Y1,pi/20);
X1=X1-1.9;Y1=Y1+2.2;
X2=X2.*1.3;Y2=Y2.*.58;
[X2,Y2]=rotateData(X2,Y2,pi/16);
X2=X2-2.4;Y2=Y2+2.1;
fill([X1,X2(end:-1:1)],[Y1,Y2(end:-1:1)],[250,250,250]./255,...
'EdgeColor',[240,240,240]./255,'LineWidth',2.5)
% Draw belly
[X,Y]=getEllipse([.6,-2.5],.8,.65,pi/12,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[230,230,230]./255,'LineWidth',1.8)
% Draw a scarf
X=[-.35,-.39];
Y=[-1.8,-2.5];
plot(X,Y-.05,'Color',[246,168,68]./400,'LineWidth',9)
plot(X,Y,'Color',[246,168,68]./255,'LineWidth',8)
X=linspace(0,pi,100);Y=sin(X);
X=X.*.9;Y=-Y.*.2;
[X,Y]=rotateData(X,Y,pi/14);
plot(X.*1.05-1.05,Y-1.8,'Color',[246,168,68]./400,'LineWidth',9)
plot(X-.99,Y-1.8,'Color',[246,168,68]./255,'LineWidth',8)
% Text
text(.6,-2.5,'BEIJING 2022','HorizontalAlignment','center','Color',[.2,.2,.2],...
'FontSize',4.5,'FontName','Comic Sans MS','Rotation',15,'FontWeight','bold')
% sign
X=linspace(0,5*pi/6,100);Y=-sin(X);
X=X.*.13;Y=Y.*.13;
[X,Y]=rotateData(X,Y,-2*pi/3);
plot(X+.6,Y-2.7,'Color',[212,62,80]./400,'LineWidth',1.5)
[X,Y]=rotateData(X,Y,pi/4);
plot(X+.65,Y-2.75,'Color',[51,119,180]./400,'LineWidth',1.5)
[X,Y]=rotateData(X,Y,pi/4);
plot(X+.7,Y-2.8,'Color',[174,222,93]./400,'LineWidth',1.5)
% =========================================================================
% Ellipse data point generating function
function [X,Y]=getEllipse(Mu,XR,YR,theta,pntNum)
% Mu | Center point
% XR,YR | Before the rotation X,Y Half shaft length
% theta | Rotation Angle
% pntNum | Number of generated data points
tList=linspace(0,2*pi,pntNum);
X=cos(tList).*XR;
Y=sin(tList).*YR;
rotateMat=[cos(theta),-sin(theta);sin(theta),cos(theta)];
XY=rotateMat*[X;Y]+Mu(:);
X=XY(1,:);Y=XY(2,:);
end
% Data rotation angle
function [X,Y]=rotateData(X,Y,theta)
rotateMat=[cos(theta),-sin(theta);sin(theta),cos(theta)];
XY=rotateMat*[X;Y];
X=XY(1,:);Y=XY(2,:);
end
end
Dynamically draw complete code
function xuerongronggif
ax=gca;
ax.DataAspectRatio=[1 1 1];
ax.XLim=[-5 5];
ax.YLim=[-5 5];
hold(ax,'on')
% Draw the arm
[X,Y]=getEllipse([-1,-2.5],.4,.6,-pi/5,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.7,-1.89],.4,.6,pi/3.6,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
pause(.5)
% Draw legs
rectangle('Position',[-.95,-4.2,1.3,1],'Curvature',.8,...
'FaceColor',[182,50,2]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
rectangle('Position',[-1,-3.9,1.4,1],'Curvature',.8,...
'FaceColor',[246,168,68]./255,'EdgeColor',[246,168,68]./255,'LineWidth',1.8)
rectangle('Position',[-1,-3.8,1.4,1],'Curvature',.8,...
'FaceColor',[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
rectangle('Position',[.5,-4.2,1.2,1],'Curvature',.8,...
'FaceColor',[182,50,2]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
rectangle('Position',[.45,-3.9,1.3,1],'Curvature',.8,...
'FaceColor',[246,168,68]./255,'EdgeColor',[246,168,68]./255,'LineWidth',1.8)
rectangle('Position',[.45,-3.8,1.3,1],'Curvature',.8,...
'FaceColor',[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
pause(.5)
% Draw the body
rectangle('Position',[-.9,-3.5,2.6,3],'Curvature',.6,...
'FaceColor',[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
pause(.5)
% Draw the head
[X0,Y0]=getEllipse([-.15,.65],2.9,2.3,pi/11,200);
fill(X0,Y0,[212,3,28]./255,'EdgeColor',[153,12,40]./255,'LineWidth',1.8)
pause(.5)
[X,Y]=getEllipse([-.15,.65],2.7,2.3,pi/11,200);
plot(X,Y,'Color',[236,136,74]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-.15,.65],1.7,2.3,pi/11,200);
plot(X,Y,'Color',[236,136,74]./255,'LineWidth',1.8)
X=linspace(0,pi,100);Y=sin(X);
X=X.*1.4;Y=Y.*0.2;
[X,Y]=rotateData(X,Y,-pi/11);
plot(Y+.41,X-1.46,'Color',[236,136,74]./255,'LineWidth',2)
plot(X0,Y0,'Color',[212,3,28]./255,'LineWidth',3)
pause(.5)
% Draw clouds on your face
[X,Y]=getEllipse([-1.2,-.3],.5,.6,pi/3.4,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-1.3,.4],.45,.55,-pi/3.4,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-.65,1],.45,.7,-pi/4,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([0,1],.45,.7,-pi/4,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.8,.5],.4,.5,pi/5,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.63,.92],.4,.5,pi/12,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([.3,.25],1.6,1,pi/13,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[250,250,250]./255,'LineWidth',1.8)
[X,Y]=getEllipse([.95,1.42],.3,.3,pi/12,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
pause(.5)
% Draw powder Blusher
[X,Y]=getEllipse([-1.1,-.5],.35,.35,pi/12,200);
fill(X,Y,[212,3,28]./255,'EdgeColor','none','FaceAlpha',.2)
[X,Y]=getEllipse([-1.1,-.5],.32,.32,pi/12,200);
fill(X+3,Y+.9,[212,3,28]./255,'EdgeColor','none','FaceAlpha',.2)
pause(.5)
% Draw the eyes
[X,Y]=getEllipse([-.76,.16],.15,.24,pi/20,200);
fill(X,Y,[38,23,26]./255,'EdgeColor',[38,23,26]./255)
[X,Y]=getEllipse([1.25,.47],.15,.24,pi/20,200);
fill(X,Y,[38,23,26]./255,'EdgeColor',[38,23,26]./255)
[X,Y]=getEllipse([-.81,.21],.05,.05,pi/20,200);
fill(X,Y,[230,230,230]./255,'EdgeColor','none')
[X,Y]=getEllipse([1.2,.52],.05,.05,pi/20,200);
fill(X,Y,[230,230,230]./255,'EdgeColor','none')
pause(.5)
% Draw headdress
[X,Y]=getEllipse([-1.85,2.2],.48,.15,pi/20,200);
fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-.7,2.4],.47,.2,pi/15,200);
fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)
[X,Y]=getEllipse([.32,2.55],.47,.15,pi/15,200);
fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.2,2.6],.25,.14,pi/30,200);
fill(X,Y,[236,136,74]./255,'EdgeColor',[236,136,74]./255,'LineWidth',1.8)
%
[X,Y]=getEllipse([-1.8,2.1],.08,.2,-pi/10,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
[X,Y]=getEllipse([-.7,2.3],.08,.2,-pi/40,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
[X,Y]=getEllipse([.4,2.5],.08,.2,-pi/40,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
[X,Y]=getEllipse([1.25,2.5],.04,.12,pi/10,200);
fill(X,Y,[212,3,28]./255,'EdgeColor',[212,3,28]./255,'LineWidth',1.8)
pause(.5)
% Paint golden moire
[X,Y]=getEllipse([-.3,3.6],.3,.35,pi/10-pi/5,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[246,168,68]./255,'LineWidth',2)
[X,Y]=getEllipse([-1,3.4],.3,.35,pi/10+pi/5,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[246,168,68]./255,'LineWidth',2)
[X,Y]=getEllipse([-.7,3.6],.35,.4,pi/10,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[246,168,68]./255,'LineWidth',2)
X=linspace(0+pi/10,pi-pi/10,200);
Y=sin(X);
X=X.*.4;Y=Y.*.3;
[X,Y]=rotateData(X,Y,pi/10);
plot(X-1.3,Y+3.2,'Color',[250,250,250]./255,'LineWidth',7)
pause(.5)
% Draw a small hat
[X,Y]=getEllipse([0,0],1,.9,pi/12,200);Y=Y-.3;
Y(Y<=0)=Y(Y<=0).*.2;
[X,Y]=rotateData(X,Y,pi/14);
fill(X-.4,Y+2.8,[212,3,28]./255,'EdgeColor',[182,50,2]./255,'LineWidth',1.8)
pause(.5)
% Draw the snow on your head
X1=linspace(-2*pi/3,(5+2/3)*pi,200);
Y1=sin(X1);
X2=linspace(0,pi,200);
Y2=sin(X2);
X1=X1.*.22;Y1=Y1.*.1;
[X1,Y1]=rotateData(X1,Y1,pi/20);
X1=X1-1.9;Y1=Y1+2.2;
X2=X2.*1.3;Y2=Y2.*.58;
[X2,Y2]=rotateData(X2,Y2,pi/16);
X2=X2-2.4;Y2=Y2+2.1;
fill([X1,X2(end:-1:1)],[Y1,Y2(end:-1:1)],[250,250,250]./255,...
'EdgeColor',[240,240,240]./255,'LineWidth',2.5)
pause(.5)
% Draw belly
[X,Y]=getEllipse([.6,-2.5],.8,.65,pi/12,200);
fill(X,Y,[250,250,250]./255,'EdgeColor',[230,230,230]./255,'LineWidth',1.8)
pause(.5)
% Draw a scarf
X=[-.35,-.39];
Y=[-1.8,-2.5];
plot(X,Y-.05,'Color',[246,168,68]./400,'LineWidth',9)
plot(X,Y,'Color',[246,168,68]./255,'LineWidth',8)
X=linspace(0,pi,100);Y=sin(X);
X=X.*.9;Y=-Y.*.2;
[X,Y]=rotateData(X,Y,pi/14);
plot(X.*1.05-1.05,Y-1.8,'Color',[246,168,68]./400,'LineWidth',9)
plot(X-.99,Y-1.8,'Color',[246,168,68]./255,'LineWidth',8)
pause(.5)
% Text
text(.6,-2.5,'BEIJING 2022','HorizontalAlignment','center','Color',[.2,.2,.2],...
'FontSize',4.5,'FontName','Comic Sans MS','Rotation',15,'FontWeight','bold')
pause(.5)
% sign
X=linspace(0,5*pi/6,100);Y=-sin(X);
X=X.*.13;Y=Y.*.13;
[X,Y]=rotateData(X,Y,-2*pi/3);
plot(X+.6,Y-2.7,'Color',[212,62,80]./400,'LineWidth',1.5)
[X,Y]=rotateData(X,Y,pi/4);
plot(X+.65,Y-2.75,'Color',[51,119,180]./400,'LineWidth',1.5)
[X,Y]=rotateData(X,Y,pi/4);
plot(X+.7,Y-2.8,'Color',[174,222,93]./400,'LineWidth',1.5)
pause(.5)
% =========================================================================
% Ellipse data point generating function
function [X,Y]=getEllipse(Mu,XR,YR,theta,pntNum)
% Mu | Center point
% XR,YR | Before the rotation X,Y Half shaft length
% theta | Rotation Angle
% pntNum | Number of generated data points
tList=linspace(0,2*pi,pntNum);
X=cos(tList).*XR;
Y=sin(tList).*YR;
rotateMat=[cos(theta),-sin(theta);sin(theta),cos(theta)];
XY=rotateMat*[X;Y]+Mu(:);
X=XY(1,:);Y=XY(2,:);
end
% Data rotation angle
function [X,Y]=rotateData(X,Y,theta)
rotateMat=[cos(theta),-sin(theta);sin(theta),cos(theta)];
XY=rotateMat*[X;Y];
X=XY(1,:);Y=XY(2,:);
end
end
边栏推荐
- Leetcode simple question: check whether each row and column contain all integers
- 1.3 years of work experience, double non naked resignation agency face-to-face experience [already employed]
- database mirroring
- Poj3414广泛搜索
- 数据泄露怎么办?'华生·K'7招消灭安全威胁
- Business learning of mall commodity module
- HDU 4391 Paint The Wall 段树(水
- Lightweight dynamic monitorable thread pool based on configuration center - dynamictp
- Summary of El and JSTL precautions
- Codeforces 12D Ball 树形阵列模拟3排序元素
猜你喜欢

Ad637 notes d'utilisation

2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*

Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer

Huawei cloud modelarts text classification - takeout comments

Business learning of mall order module

Advantages and disadvantages of the "Chris Richardson microservice series" microservice architecture

Common interview questions of redis factory

科技云报道荣膺全球云计算大会“云鼎奖”2013-2022十周年特别贡献奖

Talking about MySQL index

Oracle hint understanding
随机推荐
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
The statistics of leetcode simple question is the public string that has appeared once
如何向mongoDB中添加新的字段附代码(全)
Common interview questions of redis factory
How to view Apache log4j 2 remote code execution vulnerability?
Efficiency difference between row first and column first traversal of mat data types in opencv
Overview of database recovery
Index optimization of performance tuning methodology
HDU 4391 paint the wall segment tree (water
Serializability of concurrent scheduling
ICMP 介绍
CA certificate trampled pit
About the writing method of SQL field "this includes" and "included in" strings
MMAP learning
Image editor for their AutoLayout environment
如何開發引入小程序插件
How to organize an actual attack and defense drill
华为游戏多媒体调用切换房间方法出现异常Internal system error. Reason:90000017
AD637使用筆記
华为游戏多媒体服务调用屏蔽指定玩家语音方法,返回错误码3010