資源簡介
本算法用matlab實現了對波音747的飛行控制

代碼片段和文件信息
%?Clean?the?variables?
clear?all;
%?Define?the?parameter?t
n=4;
t=0:0.02:n*pi;
%?Define?a?and?b
a=8;
b=1;
%?Access?the?3D?World?from?MATLAB
world=vrworld(‘my_plane.wrl‘?‘new‘);
open(world);
fig=vrfigure(world);
set(fig?‘Viewpoint‘?‘Far?View‘);
airpln=vrnode(world?‘Plane‘);
vector_z=[0?0?1];
%?Create?the?simulation?loop
for?i=1:length(t)
????pause?(0.01);
????vector_position=[a*cos(t(i))?b*t(i)?a*sin(t(i))];
????%?Translation?setting?for?the?Plane?node
????airpln.translation=vector_position;
????%?Compute?the?cross?product?and?the?amount?of?rotation?theta
????vector_velocity=[-a*sin(t(i))?b?a*cos(t(i))];
????vector=cross(vector_velocity?vector_z);
????vector=vector/norm(vector);
????theta=acos(dot(vector_velocity?vector_z)/(norm(vector_velocity)*norm(vector_z)));
????%?Rotation?setting?for?the?Plane?node
????airpln.rotation=[vector?-theta];
????%?Update?the?figure
????vrdrawnow;
end
%?Exit?gracefully
pause;
close(world)
delete(world)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1002??2009-12-16?23:16??Plane_Helix.m
?????文件???????88574??2009-12-16?23:20??Slides.pdf
?????文件????????1551??2010-07-01?14:21??license.txt
?????文件???????28644??2009-12-16?15:41??my_plane.wrl
?????文件???????26359??2009-12-16?23:19??my_plane_anim_1.PNG
?????目錄???????????0??2009-12-16?15:41??texture\
評論
共有 條評論