using one line of code, build a matrix with 3 columns that models an airplane in matlab

You can create a matrix with 3 columns that models an airplane in MATLAB using the following one-liner:

main.m
airplane = [ones(10,1), zeros(10,2)];
38 chars
2 lines

This creates a matrix with 10 rows and 3 columns. The first column represents the position of the airplane along the x-axis, and it is initialized with ones. The second and third columns represents the position along the y and z-axis respectively, and they are initialized with zeros.

related categories

gistlibby LogSnag