SlideShare a Scribd company logo
1 of 14
Download to read offline
function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,selector,varargin);
% operate trajectory2(x,y,z,pitcher,roll,yaw,scale_factor,step,[selector,SoR])
%
%
% x,y,z center mechanical phenomenon (vector) [m]
%
% pitcher,roll,yaw euler's angles [rad]
%
% issue|multiplier|multiplier factor} standardisation factor [scalar]
% (related to body craft dimension)
%
% step angle sampling issue [scalar]
% (the points variety between 2 body models)
%
% chooseor select the body model [string]
%
% gripen JAS thirty-nine Gripen heli chopper
% mig Mig ah64 Apache chopper
% Felis catus Tomcat(Default) a10
% jet Generic jet cessna Cessna
% 747 Boeing 747 airplane Generic airplane
% md90 MD90 jet shuttle space vehicle
% dc10 DC-10 jet
%
% elective INPUT:
%
%
% read sets the camera read. Use Matlab's "viewer" as argument to reprocess this
read.
%
% Note:
%
% Refernce System:
% X body- The axial force on the X body axis is
% positive on forward; the momentum around X body
% is positive roll clockwise as viewered from behind;
% Y body- The facet force on the Y body axis is
% positive on the correct wing; the instant around Y
% body is positive in pitcher up;
% Z body- the conventional force on the Z body axis is
% positive down; the instant around Z body is positive
% roll clockwise as viewered from higher than.
%
% *******************************
% operate Version three.0
% 7/08/2004 (dd/mm/yyyy)
% Valerio Scordamaglia
% v.scordamaglia@tiscali.it
% *******************************
if nargin<9
disp(' Wrong:');
disp(' Wrong: Invalid variety Inputs!');
M=0;
return;
end
if (len(x)~=len(y))|(len(x)~=len(z))|(len(y)~=len(z))
disp(' Wrong:');
disp(' Uncorrect Dimension of the middle mechanical phenomenon Vectors. Please Check
the size');
M=0;
return;
end
if ((len(pitcher)~=len(roll))||(len(pitcher)~=len(yaw))||(len(roll)~=len(yaw)))
disp(' Wrong:');
disp(' Uncorrect Dimension of the euler''s angle Vectors. Please Check the size');
M=0;
return;
end
if len(pitcher)~=len(x)
disp(' Wrong:');
disp(' Size match between euler''s angle vectors and center mechanical phenomenon
vectors');
M=0;
return
end
if step>=len(x)
disp(' Wrong:');
disp(' angle samplig reckon of vary. scale back step');
M=0;
return
end
if step<1
step=1;
end
if nargin==10
theViewer=cell2mat(varargin(1));
end
if nargin>10
disp('Too several inputs arguments');
M=0;
return
end
if nargin<10
theViewer=[82.50 2];
end
mov=nargout;
cur_dir=pwd;
if strcmp(selector,'shuttle')
load shuttle;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'helicopter')
load helicopter;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'747')
load boeing_747;
V=[V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'biplane')
load biplane;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'md90')
load md90;
V=[-V(:,1) V(:,2) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'dc10')
load dc10;
V=[V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'ah64')
load ah64;
V=[V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'mig')
load mig;
V=[V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'tomcat')
load tomcat;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'jet')
load 80jet;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'cessna')
load 83plane;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'A-10')
load A-10;
V=[V(:,3) V(:,1) V(:,2)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'gripen')
load gripen;
V=[-V(:,1) -V(:,2) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
else
try
eval(['load ' selector ';']);
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
catch
str=strcat('Warning: ',selector,' not found. Default=A-10');
disp(str);
load A-10;
V=[V(:,3) V(:,1) V(:,2)];
end
end
correction=max(abs(V(:,1)));
V=V./(scale_factor*correction);
ii=len(x);
resto=mod(ii,step);
%%%%%%%%%%%%%%%needed for the transformation%%%%%%%%%%%%%%%
y=y;
z=z;
pitcher=pitcher;
roll=roll;
yaw=-yaw;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%
frame = 0;
for i=1:step:(ii-resto)
if mov | (i == 1)
clf;
plot3(x,y,z);
grid on;
hold on;
light;
end
theta=pitcher(i);
phi=-roll(i);
psi=yaw(i);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
Tbe=[cos(psi)*cos(theta), -sin(psi)*cos(theta), sin(theta);
cos(psi)*sin(theta)*sin(phi)+sin(psi)*cos(phi) ...
-sin(psi)*sin(theta)*sin(phi)+cos(psi)*cos(phi) ...
-cos(theta)*sin(phi);
-cos(psi)*sin(theta)*cos(phi)+sin(psi)*sin(phi) ...
sin(psi)*sin(theta)*cos(phi)+cos(psi)*sin(phi) ...
cos(theta)*cos(phi)];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
Vnew=V*Tbe;
rif=[x(i) y(i) z(i)];
X0=repmat(rif,size(Vnew,1),1);
Vnew=Vnew+X0;
p=patch('faces', F, 'vertices' ,Vnew);
set(p, 'facec', [1 0 0]);
set(p, 'EdgeColor','none');
if mov | (i == 1)
viewer(theViewer);
axis equal;
end
if mov
if i == 1
ax = axis;
else
axis(ax);
end
lighting phong
frame = frame + 1;
M(frame) = getframe;
end
end
Solution
function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,selector,varargin);
% operate trajectory2(x,y,z,pitcher,roll,yaw,scale_factor,step,[selector,SoR])
%
%
% x,y,z center mechanical phenomenon (vector) [m]
%
% pitcher,roll,yaw euler's angles [rad]
%
% issue|multiplier|multiplier factor} standardisation factor [scalar]
% (related to body craft dimension)
%
% step angle sampling issue [scalar]
% (the points variety between 2 body models)
%
% chooseor select the body model [string]
%
% gripen JAS thirty-nine Gripen heli chopper
% mig Mig ah64 Apache chopper
% Felis catus Tomcat(Default) a10
% jet Generic jet cessna Cessna
% 747 Boeing 747 airplane Generic airplane
% md90 MD90 jet shuttle space vehicle
% dc10 DC-10 jet
%
% elective INPUT:
%
%
% read sets the camera read. Use Matlab's "viewer" as argument to reprocess this
read.
%
% Note:
%
% Refernce System:
% X body- The axial force on the X body axis is
% positive on forward; the momentum around X body
% is positive roll clockwise as viewered from behind;
% Y body- The facet force on the Y body axis is
% positive on the correct wing; the instant around Y
% body is positive in pitcher up;
% Z body- the conventional force on the Z body axis is
% positive down; the instant around Z body is positive
% roll clockwise as viewered from higher than.
%
% *******************************
% operate Version three.0
% 7/08/2004 (dd/mm/yyyy)
% Valerio Scordamaglia
% v.scordamaglia@tiscali.it
% *******************************
if nargin<9
disp(' Wrong:');
disp(' Wrong: Invalid variety Inputs!');
M=0;
return;
end
if (len(x)~=len(y))|(len(x)~=len(z))|(len(y)~=len(z))
disp(' Wrong:');
disp(' Uncorrect Dimension of the middle mechanical phenomenon Vectors. Please Check
the size');
M=0;
return;
end
if ((len(pitcher)~=len(roll))||(len(pitcher)~=len(yaw))||(len(roll)~=len(yaw)))
disp(' Wrong:');
disp(' Uncorrect Dimension of the euler''s angle Vectors. Please Check the size');
M=0;
return;
end
if len(pitcher)~=len(x)
disp(' Wrong:');
disp(' Size match between euler''s angle vectors and center mechanical phenomenon
vectors');
M=0;
return
end
if step>=len(x)
disp(' Wrong:');
disp(' angle samplig reckon of vary. scale back step');
M=0;
return
end
if step<1
step=1;
end
if nargin==10
theViewer=cell2mat(varargin(1));
end
if nargin>10
disp('Too several inputs arguments');
M=0;
return
end
if nargin<10
theViewer=[82.50 2];
end
mov=nargout;
cur_dir=pwd;
if strcmp(selector,'shuttle')
load shuttle;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'helicopter')
load helicopter;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'747')
load boeing_747;
V=[V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'biplane')
load biplane;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'md90')
load md90;
V=[-V(:,1) V(:,2) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'dc10')
load dc10;
V=[V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'ah64')
load ah64;
V=[V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'mig')
load mig;
V=[V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'tomcat')
load tomcat;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'jet')
load 80jet;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'cessna')
load 83plane;
V=[-V(:,2) V(:,1) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'A-10')
load A-10;
V=[V(:,3) V(:,1) V(:,2)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
elseif strcmp(selector,'gripen')
load gripen;
V=[-V(:,1) -V(:,2) V(:,3)];
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
else
try
eval(['load ' selector ';']);
V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1));
catch
str=strcat('Warning: ',selector,' not found. Default=A-10');
disp(str);
load A-10;
V=[V(:,3) V(:,1) V(:,2)];
end
end
correction=max(abs(V(:,1)));
V=V./(scale_factor*correction);
ii=len(x);
resto=mod(ii,step);
%%%%%%%%%%%%%%%needed for the transformation%%%%%%%%%%%%%%%
y=y;
z=z;
pitcher=pitcher;
roll=roll;
yaw=-yaw;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%
frame = 0;
for i=1:step:(ii-resto)
if mov | (i == 1)
clf;
plot3(x,y,z);
grid on;
hold on;
light;
end
theta=pitcher(i);
phi=-roll(i);
psi=yaw(i);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
Tbe=[cos(psi)*cos(theta), -sin(psi)*cos(theta), sin(theta);
cos(psi)*sin(theta)*sin(phi)+sin(psi)*cos(phi) ...
-sin(psi)*sin(theta)*sin(phi)+cos(psi)*cos(phi) ...
-cos(theta)*sin(phi);
-cos(psi)*sin(theta)*cos(phi)+sin(psi)*sin(phi) ...
sin(psi)*sin(theta)*cos(phi)+cos(psi)*sin(phi) ...
cos(theta)*cos(phi)];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
Vnew=V*Tbe;
rif=[x(i) y(i) z(i)];
X0=repmat(rif,size(Vnew,1),1);
Vnew=Vnew+X0;
p=patch('faces', F, 'vertices' ,Vnew);
set(p, 'facec', [1 0 0]);
set(p, 'EdgeColor','none');
if mov | (i == 1)
viewer(theViewer);
axis equal;
end
if mov
if i == 1
ax = axis;
else
axis(ax);
end
lighting phong
frame = frame + 1;
M(frame) = getframe;
end
end

More Related Content

Similar to function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdf

Theme 78
Theme 78Theme 78
Theme 78
aks29
 
Please show the whole code... Im very confused. Matlab code for ea.pdf
Please show the whole code... Im very confused. Matlab code for ea.pdfPlease show the whole code... Im very confused. Matlab code for ea.pdf
Please show the whole code... Im very confused. Matlab code for ea.pdf
arshiartpalace
 
Synthesis of Research Project-FlappingWing
Synthesis of Research Project-FlappingWingSynthesis of Research Project-FlappingWing
Synthesis of Research Project-FlappingWing
Karthik Ch
 
Aircraft Loads 5 Report
Aircraft Loads 5 ReportAircraft Loads 5 Report
Aircraft Loads 5 Report
Lee Ramsay
 
EE660_Report_YaxinLiu_8448347171
EE660_Report_YaxinLiu_8448347171EE660_Report_YaxinLiu_8448347171
EE660_Report_YaxinLiu_8448347171
Yaxin Liu
 
Paper_Flutter
Paper_FlutterPaper_Flutter
Paper_Flutter
Ram Mohan
 

Similar to function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdf (20)

Coding matlab
Coding matlabCoding matlab
Coding matlab
 
Determination of Flutter Angle by Resolving Effective Gyroscope Couple to Ret...
Determination of Flutter Angle by Resolving Effective Gyroscope Couple to Ret...Determination of Flutter Angle by Resolving Effective Gyroscope Couple to Ret...
Determination of Flutter Angle by Resolving Effective Gyroscope Couple to Ret...
 
Unmanned Airplane Autopilot Tuning
Unmanned Airplane Autopilot TuningUnmanned Airplane Autopilot Tuning
Unmanned Airplane Autopilot Tuning
 
Theme 78
Theme 78Theme 78
Theme 78
 
Please show the whole code... Im very confused. Matlab code for ea.pdf
Please show the whole code... Im very confused. Matlab code for ea.pdfPlease show the whole code... Im very confused. Matlab code for ea.pdf
Please show the whole code... Im very confused. Matlab code for ea.pdf
 
Data manipulation with dplyr
Data manipulation with dplyrData manipulation with dplyr
Data manipulation with dplyr
 
Synthesis of Research Project-FlappingWing
Synthesis of Research Project-FlappingWingSynthesis of Research Project-FlappingWing
Synthesis of Research Project-FlappingWing
 
Aircraft Loads 5 Report
Aircraft Loads 5 ReportAircraft Loads 5 Report
Aircraft Loads 5 Report
 
R/Finance 2009 Chicago
R/Finance 2009 ChicagoR/Finance 2009 Chicago
R/Finance 2009 Chicago
 
EE660_Report_YaxinLiu_8448347171
EE660_Report_YaxinLiu_8448347171EE660_Report_YaxinLiu_8448347171
EE660_Report_YaxinLiu_8448347171
 
Main code for images
Main code for imagesMain code for images
Main code for images
 
Synthesis of feedback controls using optimization theory
Synthesis of feedback controls using optimization theorySynthesis of feedback controls using optimization theory
Synthesis of feedback controls using optimization theory
 
dplyr
dplyrdplyr
dplyr
 
M.Goman et al (1993) - Aircraft Spin Prevention / Recovery Control System
M.Goman et al (1993) - Aircraft Spin Prevention / Recovery Control SystemM.Goman et al (1993) - Aircraft Spin Prevention / Recovery Control System
M.Goman et al (1993) - Aircraft Spin Prevention / Recovery Control System
 
The research of 6-DOF flight simulator washout filter Control Method
The research of 6-DOF flight simulator washout filter Control MethodThe research of 6-DOF flight simulator washout filter Control Method
The research of 6-DOF flight simulator washout filter Control Method
 
FAIQ MANUAL.pdf
FAIQ MANUAL.pdfFAIQ MANUAL.pdf
FAIQ MANUAL.pdf
 
Seth Hutchinson - Progress Toward a Robotic Bat
Seth Hutchinson -  Progress Toward a Robotic BatSeth Hutchinson -  Progress Toward a Robotic Bat
Seth Hutchinson - Progress Toward a Robotic Bat
 
Paper_Flutter
Paper_FlutterPaper_Flutter
Paper_Flutter
 
Computation Assignment Help
Computation Assignment Help Computation Assignment Help
Computation Assignment Help
 
Linear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller AssignmentLinear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller Assignment
 

More from singhanubhav1234

Stereoisomers are isomeric molecules that have th.pdf
                     Stereoisomers are isomeric molecules that have th.pdf                     Stereoisomers are isomeric molecules that have th.pdf
Stereoisomers are isomeric molecules that have th.pdf
singhanubhav1234
 
Salt dissolving in water physical or chemical Def.pdf
                     Salt dissolving in water physical or chemical Def.pdf                     Salt dissolving in water physical or chemical Def.pdf
Salt dissolving in water physical or chemical Def.pdf
singhanubhav1234
 
Lattice energy increases with charge multiplicity.pdf
                     Lattice energy increases with charge multiplicity.pdf                     Lattice energy increases with charge multiplicity.pdf
Lattice energy increases with charge multiplicity.pdf
singhanubhav1234
 
MulticastingIt is the communication between a single sender and m.pdf
MulticastingIt is the communication between a single sender and m.pdfMulticastingIt is the communication between a single sender and m.pdf
MulticastingIt is the communication between a single sender and m.pdf
singhanubhav1234
 
IntroductionFew things are more aggravating to produce on a worksi.pdf
IntroductionFew things are more aggravating to produce on a worksi.pdfIntroductionFew things are more aggravating to produce on a worksi.pdf
IntroductionFew things are more aggravating to produce on a worksi.pdf
singhanubhav1234
 
AnswerRecombinant DNA Technology It is the set of techniques tha.pdf
AnswerRecombinant DNA Technology It is the set of techniques tha.pdfAnswerRecombinant DNA Technology It is the set of techniques tha.pdf
AnswerRecombinant DNA Technology It is the set of techniques tha.pdf
singhanubhav1234
 

More from singhanubhav1234 (20)

the Zn(OH)2 precipitation reaction equation Zn2.pdf
                     the Zn(OH)2 precipitation reaction equation  Zn2.pdf                     the Zn(OH)2 precipitation reaction equation  Zn2.pdf
the Zn(OH)2 precipitation reaction equation Zn2.pdf
 
The side facing the SUN will absorb Infra-red rad.pdf
                     The side facing the SUN will absorb Infra-red rad.pdf                     The side facing the SUN will absorb Infra-red rad.pdf
The side facing the SUN will absorb Infra-red rad.pdf
 
Stereoisomers are isomeric molecules that have th.pdf
                     Stereoisomers are isomeric molecules that have th.pdf                     Stereoisomers are isomeric molecules that have th.pdf
Stereoisomers are isomeric molecules that have th.pdf
 
Salt dissolving in water physical or chemical Def.pdf
                     Salt dissolving in water physical or chemical Def.pdf                     Salt dissolving in water physical or chemical Def.pdf
Salt dissolving in water physical or chemical Def.pdf
 
POH=-log[OH-] =-log(0.005) =2.301 PH=14-2.301=11..pdf
                     POH=-log[OH-] =-log(0.005) =2.301 PH=14-2.301=11..pdf                     POH=-log[OH-] =-log(0.005) =2.301 PH=14-2.301=11..pdf
POH=-log[OH-] =-log(0.005) =2.301 PH=14-2.301=11..pdf
 
Not really. Strontium carbonate can only dissolve.pdf
                     Not really. Strontium carbonate can only dissolve.pdf                     Not really. Strontium carbonate can only dissolve.pdf
Not really. Strontium carbonate can only dissolve.pdf
 
Lattice energy increases with charge multiplicity.pdf
                     Lattice energy increases with charge multiplicity.pdf                     Lattice energy increases with charge multiplicity.pdf
Lattice energy increases with charge multiplicity.pdf
 
Lucas Test uses HCl and ZnCl2, it proceeds via Sn.pdf
                     Lucas Test uses HCl and ZnCl2, it proceeds via Sn.pdf                     Lucas Test uses HCl and ZnCl2, it proceeds via Sn.pdf
Lucas Test uses HCl and ZnCl2, it proceeds via Sn.pdf
 
The answer isD. they are significantly higher than the boiling po.pdf
The answer isD. they are significantly higher than the boiling po.pdfThe answer isD. they are significantly higher than the boiling po.pdf
The answer isD. they are significantly higher than the boiling po.pdf
 
Silica Fume is a very reactive pozzolana because of its chemical and.pdf
Silica Fume is a very reactive pozzolana because of its chemical and.pdfSilica Fume is a very reactive pozzolana because of its chemical and.pdf
Silica Fume is a very reactive pozzolana because of its chemical and.pdf
 
Problem 01 #!usrbinperl use strict; use warnings; $_ = .pdf
Problem 01 #!usrbinperl use strict; use warnings; $_ = .pdfProblem 01 #!usrbinperl use strict; use warnings; $_ = .pdf
Problem 01 #!usrbinperl use strict; use warnings; $_ = .pdf
 
enzymes active site does not have the exact sha.pdf
                     enzymes active site does not have the exact sha.pdf                     enzymes active site does not have the exact sha.pdf
enzymes active site does not have the exact sha.pdf
 
MulticastingIt is the communication between a single sender and m.pdf
MulticastingIt is the communication between a single sender and m.pdfMulticastingIt is the communication between a single sender and m.pdf
MulticastingIt is the communication between a single sender and m.pdf
 
just moved a new USB 2.0 device from a new system to an older system.pdf
just moved a new USB 2.0 device from a new system to an older system.pdfjust moved a new USB 2.0 device from a new system to an older system.pdf
just moved a new USB 2.0 device from a new system to an older system.pdf
 
IntroductionFew things are more aggravating to produce on a worksi.pdf
IntroductionFew things are more aggravating to produce on a worksi.pdfIntroductionFew things are more aggravating to produce on a worksi.pdf
IntroductionFew things are more aggravating to produce on a worksi.pdf
 
D) Rb Solution D) Rb .pdf
                     D) Rb  Solution                     D) Rb  .pdf                     D) Rb  Solution                     D) Rb  .pdf
D) Rb Solution D) Rb .pdf
 
idkSolutionidk.pdf
idkSolutionidk.pdfidkSolutionidk.pdf
idkSolutionidk.pdf
 
Evolution of mitochondria.Mitochondria are believed to have arisen.pdf
Evolution of mitochondria.Mitochondria are believed to have arisen.pdfEvolution of mitochondria.Mitochondria are believed to have arisen.pdf
Evolution of mitochondria.Mitochondria are believed to have arisen.pdf
 
DSolutionD.pdf
DSolutionD.pdfDSolutionD.pdf
DSolutionD.pdf
 
AnswerRecombinant DNA Technology It is the set of techniques tha.pdf
AnswerRecombinant DNA Technology It is the set of techniques tha.pdfAnswerRecombinant DNA Technology It is the set of techniques tha.pdf
AnswerRecombinant DNA Technology It is the set of techniques tha.pdf
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,se.pdf

  • 1. function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,selector,varargin); % operate trajectory2(x,y,z,pitcher,roll,yaw,scale_factor,step,[selector,SoR]) % % % x,y,z center mechanical phenomenon (vector) [m] % % pitcher,roll,yaw euler's angles [rad] % % issue|multiplier|multiplier factor} standardisation factor [scalar] % (related to body craft dimension) % % step angle sampling issue [scalar] % (the points variety between 2 body models) % % chooseor select the body model [string] % % gripen JAS thirty-nine Gripen heli chopper % mig Mig ah64 Apache chopper % Felis catus Tomcat(Default) a10 % jet Generic jet cessna Cessna % 747 Boeing 747 airplane Generic airplane % md90 MD90 jet shuttle space vehicle % dc10 DC-10 jet % % elective INPUT: % % % read sets the camera read. Use Matlab's "viewer" as argument to reprocess this read. % % Note: % % Refernce System: % X body- The axial force on the X body axis is % positive on forward; the momentum around X body
  • 2. % is positive roll clockwise as viewered from behind; % Y body- The facet force on the Y body axis is % positive on the correct wing; the instant around Y % body is positive in pitcher up; % Z body- the conventional force on the Z body axis is % positive down; the instant around Z body is positive % roll clockwise as viewered from higher than. % % ******************************* % operate Version three.0 % 7/08/2004 (dd/mm/yyyy) % Valerio Scordamaglia % v.scordamaglia@tiscali.it % ******************************* if nargin<9 disp(' Wrong:'); disp(' Wrong: Invalid variety Inputs!'); M=0; return; end if (len(x)~=len(y))|(len(x)~=len(z))|(len(y)~=len(z)) disp(' Wrong:'); disp(' Uncorrect Dimension of the middle mechanical phenomenon Vectors. Please Check the size'); M=0; return; end if ((len(pitcher)~=len(roll))||(len(pitcher)~=len(yaw))||(len(roll)~=len(yaw))) disp(' Wrong:'); disp(' Uncorrect Dimension of the euler''s angle Vectors. Please Check the size'); M=0; return; end if len(pitcher)~=len(x) disp(' Wrong:'); disp(' Size match between euler''s angle vectors and center mechanical phenomenon
  • 3. vectors'); M=0; return end if step>=len(x) disp(' Wrong:'); disp(' angle samplig reckon of vary. scale back step'); M=0; return end if step<1 step=1; end if nargin==10 theViewer=cell2mat(varargin(1)); end if nargin>10 disp('Too several inputs arguments'); M=0; return end if nargin<10 theViewer=[82.50 2]; end mov=nargout; cur_dir=pwd; if strcmp(selector,'shuttle') load shuttle; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'helicopter') load helicopter; V=[-V(:,2) V(:,1) V(:,3)];
  • 4. V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'747') load boeing_747; V=[V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'biplane') load biplane; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'md90') load md90; V=[-V(:,1) V(:,2) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'dc10') load dc10; V=[V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'ah64') load ah64; V=[V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'mig') load mig; V=[V(:,2) V(:,1) V(:,3)];
  • 5. V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'tomcat') load tomcat; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'jet') load 80jet; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'cessna') load 83plane; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'A-10') load A-10; V=[V(:,3) V(:,1) V(:,2)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'gripen') load gripen; V=[-V(:,1) -V(:,2) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); else try
  • 6. eval(['load ' selector ';']); V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); catch str=strcat('Warning: ',selector,' not found. Default=A-10'); disp(str); load A-10; V=[V(:,3) V(:,1) V(:,2)]; end end correction=max(abs(V(:,1))); V=V./(scale_factor*correction); ii=len(x); resto=mod(ii,step); %%%%%%%%%%%%%%%needed for the transformation%%%%%%%%%%%%%%% y=y; z=z; pitcher=pitcher; roll=roll; yaw=-yaw; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%% frame = 0; for i=1:step:(ii-resto) if mov | (i == 1) clf; plot3(x,y,z); grid on; hold on; light; end theta=pitcher(i); phi=-roll(i); psi=yaw(i); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  • 7. %%%%%%%%%%%%%%%% Tbe=[cos(psi)*cos(theta), -sin(psi)*cos(theta), sin(theta); cos(psi)*sin(theta)*sin(phi)+sin(psi)*cos(phi) ... -sin(psi)*sin(theta)*sin(phi)+cos(psi)*cos(phi) ... -cos(theta)*sin(phi); -cos(psi)*sin(theta)*cos(phi)+sin(psi)*sin(phi) ... sin(psi)*sin(theta)*cos(phi)+cos(psi)*sin(phi) ... cos(theta)*cos(phi)]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%% Vnew=V*Tbe; rif=[x(i) y(i) z(i)]; X0=repmat(rif,size(Vnew,1),1); Vnew=Vnew+X0; p=patch('faces', F, 'vertices' ,Vnew); set(p, 'facec', [1 0 0]); set(p, 'EdgeColor','none'); if mov | (i == 1) viewer(theViewer); axis equal; end if mov if i == 1 ax = axis; else axis(ax); end lighting phong frame = frame + 1; M(frame) = getframe; end end Solution function [M]=trajectory3(x,y,z,pitcher,roll,yaw,scale_factor,step,selector,varargin);
  • 8. % operate trajectory2(x,y,z,pitcher,roll,yaw,scale_factor,step,[selector,SoR]) % % % x,y,z center mechanical phenomenon (vector) [m] % % pitcher,roll,yaw euler's angles [rad] % % issue|multiplier|multiplier factor} standardisation factor [scalar] % (related to body craft dimension) % % step angle sampling issue [scalar] % (the points variety between 2 body models) % % chooseor select the body model [string] % % gripen JAS thirty-nine Gripen heli chopper % mig Mig ah64 Apache chopper % Felis catus Tomcat(Default) a10 % jet Generic jet cessna Cessna % 747 Boeing 747 airplane Generic airplane % md90 MD90 jet shuttle space vehicle % dc10 DC-10 jet % % elective INPUT: % % % read sets the camera read. Use Matlab's "viewer" as argument to reprocess this read. % % Note: % % Refernce System: % X body- The axial force on the X body axis is % positive on forward; the momentum around X body % is positive roll clockwise as viewered from behind; % Y body- The facet force on the Y body axis is
  • 9. % positive on the correct wing; the instant around Y % body is positive in pitcher up; % Z body- the conventional force on the Z body axis is % positive down; the instant around Z body is positive % roll clockwise as viewered from higher than. % % ******************************* % operate Version three.0 % 7/08/2004 (dd/mm/yyyy) % Valerio Scordamaglia % v.scordamaglia@tiscali.it % ******************************* if nargin<9 disp(' Wrong:'); disp(' Wrong: Invalid variety Inputs!'); M=0; return; end if (len(x)~=len(y))|(len(x)~=len(z))|(len(y)~=len(z)) disp(' Wrong:'); disp(' Uncorrect Dimension of the middle mechanical phenomenon Vectors. Please Check the size'); M=0; return; end if ((len(pitcher)~=len(roll))||(len(pitcher)~=len(yaw))||(len(roll)~=len(yaw))) disp(' Wrong:'); disp(' Uncorrect Dimension of the euler''s angle Vectors. Please Check the size'); M=0; return; end if len(pitcher)~=len(x) disp(' Wrong:'); disp(' Size match between euler''s angle vectors and center mechanical phenomenon vectors'); M=0;
  • 10. return end if step>=len(x) disp(' Wrong:'); disp(' angle samplig reckon of vary. scale back step'); M=0; return end if step<1 step=1; end if nargin==10 theViewer=cell2mat(varargin(1)); end if nargin>10 disp('Too several inputs arguments'); M=0; return end if nargin<10 theViewer=[82.50 2]; end mov=nargout; cur_dir=pwd; if strcmp(selector,'shuttle') load shuttle; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'helicopter') load helicopter; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
  • 11. V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'747') load boeing_747; V=[V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'biplane') load biplane; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'md90') load md90; V=[-V(:,1) V(:,2) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'dc10') load dc10; V=[V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'ah64') load ah64; V=[V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'mig') load mig; V=[V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1));
  • 12. V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'tomcat') load tomcat; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'jet') load 80jet; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'cessna') load 83plane; V=[-V(:,2) V(:,1) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'A-10') load A-10; V=[V(:,3) V(:,1) V(:,2)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); elseif strcmp(selector,'gripen') load gripen; V=[-V(:,1) -V(:,2) V(:,3)]; V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1)); V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); else try eval(['load ' selector ';']); V(:,1)=V(:,1)-round(sum(V(:,1))/size(V,1));
  • 13. V(:,2)=V(:,2)-round(sum(V(:,2))/size(V,1)); V(:,3)=V(:,3)-round(sum(V(:,3))/size(V,1)); catch str=strcat('Warning: ',selector,' not found. Default=A-10'); disp(str); load A-10; V=[V(:,3) V(:,1) V(:,2)]; end end correction=max(abs(V(:,1))); V=V./(scale_factor*correction); ii=len(x); resto=mod(ii,step); %%%%%%%%%%%%%%%needed for the transformation%%%%%%%%%%%%%%% y=y; z=z; pitcher=pitcher; roll=roll; yaw=-yaw; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%% frame = 0; for i=1:step:(ii-resto) if mov | (i == 1) clf; plot3(x,y,z); grid on; hold on; light; end theta=pitcher(i); phi=-roll(i); psi=yaw(i); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%% Tbe=[cos(psi)*cos(theta), -sin(psi)*cos(theta), sin(theta);
  • 14. cos(psi)*sin(theta)*sin(phi)+sin(psi)*cos(phi) ... -sin(psi)*sin(theta)*sin(phi)+cos(psi)*cos(phi) ... -cos(theta)*sin(phi); -cos(psi)*sin(theta)*cos(phi)+sin(psi)*sin(phi) ... sin(psi)*sin(theta)*cos(phi)+cos(psi)*sin(phi) ... cos(theta)*cos(phi)]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%% Vnew=V*Tbe; rif=[x(i) y(i) z(i)]; X0=repmat(rif,size(Vnew,1),1); Vnew=Vnew+X0; p=patch('faces', F, 'vertices' ,Vnew); set(p, 'facec', [1 0 0]); set(p, 'EdgeColor','none'); if mov | (i == 1) viewer(theViewer); axis equal; end if mov if i == 1 ax = axis; else axis(ax); end lighting phong frame = frame + 1; M(frame) = getframe; end end