[原创]matlab展示旋转直线形成单叶双曲面

标签:
单叶双曲面直线旋转形成matlab |
分类: 程序Linux电脑学习 |
给朋友做个展示图,展示“旋转一条直线形成单叶双曲面的过程”。gif图片如下:
matlab代码如下:
% Function: Demonstrate the formation of Uniparted
Hyperboloid
%
by rotating a line
% Author: felonwan@gmail.com
% Last Modified: 2012-12-25
close all
% coordinates
x=[-0.6,0.8];
y=[0.8,-0.6];
z=[3.0,-3.0];
[th,phi,r]=cart2sph(x,y,z);
n=120;%divided the circle into n pieces
k=24;%pause and write it to the animation every k pieces
% figure properties setting
hf=figure;
axis([-2,2,-2,2,-4,4]);
hold on
% lines
hc=plot3([0,0],[0,0],[-3.9,3.9],'b');
hl0=plot3(x,y,z,'r');
hlt0=plot3([0,x(1)],[0,y(1)],[z(1),z(1)],'r--');
hlb0=plot3([0,x(2)],[0,y(2)],[z(2),z(2)],'r--');
% gif figure setting
gifFilename='UnipartedHyperboloid.gif';
ifr=0;
for i=1:n
end
前一篇:Win 8 Pro简单体验
后一篇:ubuntu 12.04使用经验