finalver
This commit is contained in:
commit
9a8e18b70a
|
@ -0,0 +1,62 @@
|
||||||
|
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;
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
f1x = table2array(readtable('wsf2x.csv'));
|
||||||
|
f1y = table2array(readtable('wsf2y.csv'));
|
||||||
|
f1z = table2array(readtable('wsf2z.csv'));
|
||||||
|
f2x = table2array(readtable('wsf1x.csv'));
|
||||||
|
f2y = table2array(readtable('wsf1y.csv'));
|
||||||
|
f2z = table2array(readtable('wsf1z.csv'));
|
||||||
|
n = 35;
|
||||||
|
|
||||||
|
initx1=zeros(1,35);
|
||||||
|
inity1=zeros(1,35);
|
||||||
|
initz1=zeros(1,35);
|
||||||
|
finalx1=zeros(1,35);
|
||||||
|
finaly1=zeros(1,35);
|
||||||
|
finalz1=zeros(1,35);
|
||||||
|
|
||||||
|
initx=zeros(1,35);
|
||||||
|
inity=zeros(1,35);
|
||||||
|
initz=zeros(1,35);
|
||||||
|
finalx=zeros(1,35);
|
||||||
|
finaly=zeros(1,35);
|
||||||
|
finalz=zeros(1,35);
|
||||||
|
scatter3(0,0,0,0.1)
|
||||||
|
for i = 1:35
|
||||||
|
initx1(i) = 2+(i-1)*40/n;
|
||||||
|
initz1(i) = 75;
|
||||||
|
inity1(i) = 22-abs(i-18)*20/17;
|
||||||
|
finalx1(i)=5+3*mod(i-1,7);
|
||||||
|
finalz1(i)= 75+3*fix((i-1)/7);
|
||||||
|
finaly1(i)=finalz1(i)-15;
|
||||||
|
initx(i) = 15+3*mod(i-1,7);
|
||||||
|
initz(i) = 75+3*fix((i-1)/7);
|
||||||
|
inity(i) = initz(i)+5;
|
||||||
|
psai = 2*pi*i/35;
|
||||||
|
finalx(i) = 120+10*cos(psai);
|
||||||
|
finaly(i) = 80+10*sin(psai);
|
||||||
|
finalz(i) = 50;
|
||||||
|
|
||||||
|
end
|
||||||
|
for i = 1:35
|
||||||
|
|
||||||
|
x2 = f2x(i,:);
|
||||||
|
y2 = f2y(i,:);
|
||||||
|
z2 = f2z(i,:);
|
||||||
|
scatter3(x2,y2,z2,1)
|
||||||
|
hold on
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1:n
|
||||||
|
%drawflighter1(initx(i),inity(i),initz(i),0,0,0.7,50,[1 0.2510 0.2510])
|
||||||
|
%drawflighter1(finalx(i),finaly(i),finalz(i),0,0,0.7,50,[1 0.2510 0.2510])
|
||||||
|
drawflighter1(initx1(i),inity1(i),initz1(i),0,pi/2,0.7,50,[1 0.2510 0.2510])
|
||||||
|
drawflighter1(finalx1(i),finaly1(i),finalz1(i),0,pi/2,0.7,50,[1 0.2510 0.2510])
|
||||||
|
hold on
|
||||||
|
end
|
||||||
|
|
||||||
|
count1 = 0;
|
||||||
|
for i = 1:35
|
||||||
|
|
||||||
|
x1 = f1x(i,:);
|
||||||
|
y1 = f1y(i,:);
|
||||||
|
z1 = f1z(i,:);
|
||||||
|
%scatter3(x1,y1,z1,0.5)
|
||||||
|
hold on
|
||||||
|
end
|
||||||
|
[X,Y,Z] = sphere;
|
||||||
|
r = 5;
|
||||||
|
X2 = X * r;
|
||||||
|
Y2 = Y * r;
|
||||||
|
Z2 = Z * r;
|
||||||
|
%surf(X2+55,Y2+80,Z2+65)
|
||||||
|
hold on
|
||||||
|
xlabel('x方向 单位:米');
|
||||||
|
ylabel('y方向 单位:米');
|
||||||
|
zlabel('z方向 单位:米');
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue