-
大小: 113KB文件類型: .zip金幣: 2下載: 0 次發布日期: 2021-06-01
- 語言: Matlab
- 標簽: 3D??matlab版GUI??
資源簡介
3D模擬飛機飛行,在matlab GUI界面下實現,全部代碼。

代碼片段和文件信息
%?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)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-07-15?17:29??3D模擬飛機飛行\
?????文件????????1551??2010-07-01?22:21??3D模擬飛機飛行\license.txt
?????文件???????28644??2009-12-16?23:41??3D模擬飛機飛行\my_plane.wrl
?????文件???????26359??2009-12-17?07:19??3D模擬飛機飛行\my_plane_anim_1.PNG
?????文件????????1002??2009-12-17?07:16??3D模擬飛機飛行\Plane_Helix.m
?????文件???????88574??2009-12-17?07:20??3D模擬飛機飛行\Slides.pdf
?????目錄???????????0??2009-12-16?23:41??3D模擬飛機飛行\texture\
評論
共有 條評論