3D Mathematical Expressions and Functions Plots in MATLAB®

How to make xxx plots in MATLAB® with Plotly.


Plot 3-D Parametric Line

Plot the 3-D parametric line

x=sin(t)    
y=cos(t)    
z=t 

over the default parameter range [-5 5].

xt = @(t) sin(t);
yt = @(t) cos(t);
zt = @(t) t;
fplot3(xt,yt,zt)

fig2plotly()

Specify Parameter Range

Plot the parametric line

x=e-t/10sin(5t)  
y=e-t/10cos(5t)  
z=t 

over the parameter range [-10 10] by specifying the fourth input argument of fplot3.

xt = @(t) exp(-t/10).*sin(5*t);
yt = @(t) exp(-t/10).*cos(5*t);
zt = @(t) t;
fplot3(xt,yt,zt,[-10 10])

fig2plotly()

Specify Line Properties and Display Markers

Plot the same 3-D parametric curve three times over different intervals of the parameter. For the first interval, use a line width of 2 points. For the second, specify a dashed red line style with circle markers. For the third, specify a cyan, dash-dotted line style with asterisk markers.

fplot3(@(t)sin(t), @(t)cos(t), @(t)t, [0 2*pi], 'LineWidth', 2)
hold on
fplot3(@(t)sin(t), @(t)cos(t), @(t)t, [2*pi 4*pi], '--or')
fplot3(@(t)sin(t), @(t)cos(t), @(t)t, [4*pi 6*pi], '-.*c')
hold off

fig2plotly()

Plot Multiple Lines in Same Axes

Plot multiple lines in the same axes using hold on.

fplot3(@(t)t, @(t)t, @(t)t)
hold on
fplot3(@(t)-t, @(t)t, @(t)-t)
hold off

fig2plotly()