function [M]=drawflighter1(x,y,z,pitch,yaw,scale_factor,step,RGB)
%x,y,z空间位置
%pitch 俯仰角
%yaw 偏航角
% scale_factor飞机大小
%step 画图间隔
% RGB 颜色

% theView=[82.50 2];



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));


correction=max(abs(V(:,1)));
V=V./(scale_factor*correction); % 放缩尺度
ii=length(x);                   % 坐标长度
counter=mod(ii,step);             % 飞机数量


yaw=-yaw;

for i=1:step:(ii)
theta=pitch(i);
psi=yaw(i);

Tbe=[cos(psi)*cos(theta), -sin(psi)*cos(theta), sin(theta);
	 sin(psi),cos(psi),0;
	 -cos(psi)*sin(theta),sin(psi)*sin(theta),cos(theta)];

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', RGB);          
set(p, 'EdgeColor','none'); 

end

hold on
plot3(x,y,z,':','Color',[0.5 0.5 0.5],'linewidth',0.5);

    

% grid on;
% view(theView);

% daspect([1 1 1]) ;


% xlabel('X(m)');
% ylabel('Y(m)');
% zlabel('h(m)');

M=0;

