I want to create a rectangular plot where all 4 sides are part of a coordinate system.
5 views (last 30 days)
Show older comments
I have currently a linear Plot of a heading output from a flight simulator. But i would like plot this on a rectangular plot where it will be displayed like a flight route. The Values are in cells. This is my current output
Maybe somebody can help me how i can convert everything that it will be displayed like a route on the plot. As you can see the flight was just cirlcles so the lines should always overlay each other more or less.
Thanks for everybody who has an idea.
1 Comment
Fangjun Jiang
on 21 Mar 2024
You will need the flight speed. Do an integration of the speed in combination with the heading, you will get the (x,y) postion of the plane. Plotting the (x,y) will give you the flight path (likely in circles).
Answers (1)
Vinay
on 3 Sep 2024
Hii Yannick,
To visualize the flight data as a route on a rectangular plot, I would suggest you to convert the heading data into a 2D path by simulating the movement based on the heading angles.
The approach is to simulate the movement based on the heading angles, treating each angle as a direction in which the plane progresses over time.
Kindly refer to the following documentation for “deg2rad”:
% Sample heading data (in degrees)
heading_angle = [0, 45, 90, 135, 180, 225, 270, 315, 360]; % Example heading data
% Convert headings to radians
heading_angle_rad = deg2rad(heading_angle);
% Initialize position
x = 0;
y = 0;
% Store positions for plotting
x_positions = [x];
y_positions = [y];
% step size for each heading increment
step_size = 1; % Adjust this value based on your data's resolution
% Calculate positions
for i = 1:length(heading_angle_rad)
% Update position based on heading
x = x + step_size * cos(heading_angle_rad(i));
y = y + step_size * sin(heading_angle_rad(i));
% Store new position
x_positions = [x_positions, x];
y_positions = [y_positions, y];
end
% Plot the flight path
figure;
plot(x_positions, y_positions, '-o');
xlabel('X Position');
ylabel('Y Position');
title('Flight Route');
grid on;
axis equal;
0 Comments
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!