Sample Code to draw UAV Tracjectory Graph

6 visualizaciones (últimos 30 días)
Mashood Ali
Mashood Ali el 28 de Jun. de 2020
Comentada: Mashood Ali el 4 de Jul. de 2020
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!

Respuesta aceptada

Image Analyst
Image Analyst el 28 de Jun. de 2020
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 comentarios
Image Analyst
Image Analyst el 28 de Jun. de 2020
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 el 4 de Jul. de 2020
Thanks for the help man. Really appreciated!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre UAV en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by