⛄一、获取代码方式
获取代码方式1:
完整代码已上传我的资源:【导弹仿真】基于matlab导弹轨迹和撞击位置仿真【含Matlab源码 2067期】
点击上面蓝色字体,直接付费下载,即可。
获取代码方式2:
付费专栏Matlab物理应用(初级版)
备注:
点击上面蓝色字体付费专栏Matlab物理应用(初级版),扫描上面二维码,付费29.9元订阅海神之光博客付费专栏Matlab物理应用(初级版),凭支付凭证,私信博主,可免费获得1份本博客上传CSDN资源代码(有效期为订阅日起,三天内有效);
点击CSDN资源下载链接:1份本博客上传CSDN资源代码
⛄二、部分源代码
clear all;
close all;
clc;
format long;
name = ‘Zachary Pyle’;
id = ‘A12601746’;
hw_num = ‘project’;
global g
%获取所有弹道的数据
for j = 1:7
[ X0, Y0, Z0, m0, mf, Thmag0, theta, phi, Tburn ] = read_input( 'missile_data.txt', j );
[ T{j}, X{j}, Y{j}, Z{j}, U{j}, V{j}, W{j} ] = missile( X0, Y0, Z0, m0, mf, Thmag0, theta, phi, Tburn );
end
%%%%% 任务一 %%%%%%
%为图1加载地形数据
load(‘terrain.mat’);
%从图1开始
figure(1); hold on;
ground = surf(x_terrain/1000, y_terrain/1000, h_terrain/1000);
shading interp;
%为图1绘制每个轨迹
for i = 1:7
x_target = X{i}(end);
y_target = Y{i}(end);
h_target = interp2(x_terrain, y_terrain, h_terrain, x_target, y_target);
if i == 1
plot3(x_target/1000, y_target/1000, h_target/1000,'ro','MarkerSize', 10, 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r');
M1 = plot3(X{i}/1000,Y{i}/1000,Z{i}/1000,'LineWidth',2,'color','c');
elseif i == 2
landing = plot3(x_target/1000, y_target/1000, h_target/1000,'ro','MarkerSize', 10, 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r');
M2 = plot3(X{i}/1000,Y{i}/1000,Z{i}/1000,'LineWidth',2,'color','k');
elseif i == 3
plot3(x_target/1000, y_target/1000, h_target/1000,'ro','MarkerSize', 10, 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r');
M3 = plot3(X{i}/1000,Y{i}/1000,Z{i}/1000,'LineWidth',2,'color','m');
elseif i == 4
plot3(x_target/1000, y_target/1000, h_target/1000,'ro','MarkerSize', 10, 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r');
M4 = plot3(X{i}/1000,Y{i}/1000,Z{i}/1000,'LineWidth',2,'color','b');
elseif i == 5
plot3(x_target/1000, y_target/1000, h_target/1000,'ro','MarkerSize', 10, 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r');
M5 = plot3(X{i}/1000,Y{i}/1000,Z{i}/1000,'LineWidth',2,'color','y');
elseif i == 6
plot3(x_target/1000, y_target/1000, h_target/1000,'ro','MarkerSize', 10, 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r');
M6 = plot3(X{i}/1000,Y{i}/1000,Z{i}/1000,'LineWidth',2,'color','g');
elseif i == 7
plot3(x_target/1000, y_target/1000, h_target/1000,'ro','MarkerSize', 10, 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r');
M7 = plot3(X{i}/1000,Y{i}/1000,Z{i}/1000,'LineWidth',2,'color','r');
end
end
⛄三、运行结果
⛄四、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1] 门云阁.MATLAB物理计算与可视化[M].清华大学出版社,2013.
3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除