Plot the portion of the cone $z=sqrt((x − 1)^2 + y^2)$ inside the cylinder $r = 2$
This is my matlab code. However, I get an error with the ezsurf line. Any ideas as to what I might be doing wrong?
clear all;
syms theta z;
rbar = [2*cos(theta),2*sin(theta),sqrt((2*cos(theta)-1)^2+2*sin(theta)^2)];
ezsurf(rbar(1),rbar(2),rbar(3),[0,2*pi,0,5])
view([10 10 10])
It would help if you showed what error you are getting, but the crux of your problem is this:
ezsurfrequires your input functions to be in two variables. Your functionsrbarare all simply functions oftheta.You might want to use
ezplot3instead. Example:This technique uses function handles instead of the Symbolic Toolbox.
(My kingdom for people to stop using the Symbolic Toolbox).