Search code examples
matlabmatlab-figurematlab-guide

MATLAB fplot3 command


I wanted to plot the 3D surface ((e^-t)sint,(e^-t)cost,1) using the following code.

x=(exp(-t))*sin(t); y=(exp(-t))*cos(t); z=1;
    fplot3(x,y,z)

I received this error message:

Error using fplot3 (line 46)
Expected input to be one of these types:

function_handle, sym

Instead its type was double.

Solution

  • As the error message says fplot3 doesn't take numerical values. Use symbolic functions instead.

    x = @(t) exp(-t).*sin(t);
    y = @(t) exp(-t).*cos(t);
    z = @(t) t*0 + 1;
    fplot3(x,y,z);