Draw a 3D airplane

Draw a very simple 3D airplane and animate it too
4K Downloads
Updated 4 Mar 2016

View License

The c130 function draws a simple 3D airplane modelled after the Lockheed C-130. The xyz2rpy function estimates roll, pitch, and yaw from given x,y,z coordinates. No special toolboxes required.
Syntax:

c130
c130(x,y,z)
c130(...,'roll',RollDegrees)
c130(...,'pitch',PitchDegrees)
c130(...,'yaw',YawDegrees)
c130(...,'color',AirplaneColor)
c130(...,'fuselage',FuseLageColor)
c130(...,'wing',WingColor)
c130(...,'tailwing',TailwingColor)
c130(...,'fin',FinColor)
c130(...,'prop',PropellerColor)
c130(...,'scale',SizeScaleFactor)
c130(...,'z',ZScaleFactor)
c130(...,'linestyle','LineStyle')
c130(...,'linecolor',LineColor)
h = c130(...)

Description:

c130 draws a 3D airplane.

c130(x,y,z) draws an airplane centered approximately at the location given by x,y,z, where x, y, and z must be scalar values.

c130(...,'roll',RollDegrees) specifies roll of the aircraft in degrees relative to the approximate center of gravity of the aircraft.

c130(...,'pitch',PitchDegrees) specifies pitch of the aircraft in degrees.

c130(...,'yaw',YawDegrees) specifies yaw of the aircraft in degrees in the global coordinate system. The xyz2rpy function may help with determining appropriate yaw values.

c130(...,'color',AirplaneColor) specifies a color of all surfaces of the plane. Color may be given by Matlab color name (e.g., 'red'), Matlab color abbreviation (e.g., 'r'), or RGB value (e.g., [1 0 0]). The 'color' option may be paired with options for specifying colors of specific parts of the plane. For example, c130('color','b','wing',y) creates a blue airplane with yellow wings. Default color is gray.

c130(...,'fuselage',FuselageColor) specifies fuselage color.

c130(...,'wing',WingColor) specifies wing color.

c130(...,'tailwing',TailwingColor) specifies color of horizontal stabilizer wings at the tail of the plane.

c130(...,'fin',FinColor) specifies color of the vertical stabilizer fin at the tail of the plane.

c130(...,'prop',PropellerColor) specifies propeller color.

c130(...,'scale',SizeScaleFactor) scales dimensions of the plane by some scalar factor. By default, c130 draws an airplane with dimensions which approximately match the dimensions C-130 airplane in meters. If you'd like to draw a C-130 in dimensions of feet, try c130('scale',3.281).

c130(...,'z',ZScaleFactor) scales only vertical dimensions by some scalar value. This may be useful if you're animating an airplane in a coordinate system where the vertical dimension is stretched to show relief. If your axes are not equal, consider a ZScaleFactor given by the ratio of (xlim(2)-xlim(1))/(zlim(2)-zlim(1)).

c130(...,'linestyle','LineStyle') specifies style of the lines connecting surface vertices. Default is '-', but can be set to any valid linestyle, including 'none' to show a smooth surface.

c130(...,'linecolor',LineColor) specifies edge color of lines connecting surface verticies. Default line color is black.

h = c130(...) returns handles of the 13 surface objects created by c130.

Cite As

Chad Greene (2024). Draw a 3D airplane (https://www.mathworks.com/matlabcentral/fileexchange/47967-draw-a-3d-airplane), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Guidance, Navigation, and Control (GNC) in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0

MathWorks update: Added Live Script.