This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Creating 3-D Plots

This example shows how to create 3-D line plots in MATLAB using the plot3 function.

Create a regularly-spaced vector t from 0 to 10*pi using pi/50 as the increment between elements.

t = 0:pi/50:10*pi;

Calculate sine for each value in t.

st = sin(t);

Calculate cosine for each value in t.

ct = cos(t);

Use the 'plot3' function to display a three-dimensional plot of a set of data points.

figure;
plot3(st, ct, t)
xlabel('sin(t)')
ylabel('cos(t)')

Related Topics