Sample Code to draw UAV Tracjectory Graph

12 次查看(过去 30 天)
Hello there, I am quite a new user of mathworks so please forgive my ignorance.
Can someone please please guide me that how can I draw a UAV Trajectory graph on MATLAB, or something similar.
1.What exactly do I want?
  • I have this assignment in which I have to re run the mathematical equations of a paper which is related to UAV trajectories. That paper used something called cvx to solve their equations and they used that on MATLAB to simulate some results. What my requirements is to draw something similar to that. But problem is I dont know anything about CVX or MATLAB or UAV TRAJECTORY etc.
2. What have I already done?
  • I have already created a MATLAB trial account.
  • I have downloaded an old version of MATLAB(following some tutorial) and I have installed CVX on that, but since I dont have the cvx code files which were used on the paper, I cannot regenerate the results.
  • I have done considerable google searches.
  • I am also downloading R2020, with some robotics setup, I watched in a tutorial. Not entirely sure about that it is what I want.
Please guide me in the right direction, Im all over this place, sorry for that. Let me know if you want any more information from me or anything.
Thank you for your time!

采纳的回答

Image Analyst
Image Analyst 2020-6-28
Yes, but have you searched this forum? If you had, you would have seen lots of posts about projectiles where I attached a simulation program. See attached projectile demo. It lets you input lots of input parameters (height, angle, etc.) and computes practically everything you'd want to know about a projectile.
  5 个评论
Image Analyst
Image Analyst 2020-6-28
Well I can't explain 13 pages of this:
but I can give you code to plot data assuming you have the x and y coordinates:
% Initialization steps. Brute force cleanup of everything currently existing to start with a clean slate.
clc; % Clear the command window.
fprintf('Beginning to run %s.m ...\n', mfilename);
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
numPoints = 15;
% Plot first dataset in red triangles.
x = rand(1, numPoints);
y = rand(1, numPoints);
subplot(2, 1, 1);
plot(x, y, 'rv-', 'LineWidth', 2, 'MarkerSize', 12);
grid on;
hold on;
% Plot second dataset in green triangles.
x = rand(1, numPoints);
y = rand(1, numPoints);
plot(x, y, 'gv-', 'LineWidth', 2, 'MarkerSize', 12);
title('Optimized UAV trajectories without power control.', 'FontSize', fontSize);
xlabel('x(m)', 'FontSize', fontSize);
ylabel('y(m)', 'FontSize', fontSize);
legend('red', 'green', 'Location', 'northwest');
% Plot lines in solid red, solid blue, and dashed green.
subplot(2, 1, 2); % Make another graph below the first one.
% Plot first dataset in solid red.
x = sort(rand(1, numPoints), 'ascend');
y = rand(1, numPoints);
plot(x, y, 'r-', 'LineWidth', 2, 'MarkerSize', 12);
grid on;
hold on;
% Plot second dataset in solid blue.
x = sort(rand(1, numPoints), 'ascend');
y = rand(1, numPoints);
plot(x, y, 'b-', 'LineWidth', 2, 'MarkerSize', 12);
% Plot third dataset in dashed green.
x = sort(rand(1, numPoints), 'ascend');
y = rand(1, numPoints);
darkGreen = [0, 0.5, 0]; % A custom color for example.
plot(x, y, '--', 'Color', darkGreen, 'LineWidth', 2, 'MarkerSize', 12);
legend('red', 'blue', 'green');
title('UAV transmit power versus time for a two-UAV system', 'FontSize', fontSize);
xlabel('Time t (s)', 'FontSize', fontSize);
ylabel('UAV Transmit Power (W)', 'FontSize', fontSize);
% Maximize figure
g = gcf;
g.WindowState = 'maximized';
Mashood Ali
Mashood Ali 2020-7-4
Thanks for the help man. Really appreciated!!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 UAV 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by