Im trying to plot the following function: F(x,y)=Cos(x)*Sin(y) With the following features: Labeled all three axes, the x and y axes range from 0 to 2pi with 0.1 spacing, and the viewing angles are orthogonal to any x/y/z=0 plane.
I have the following code
t= 0:0.1:2*pi;
A=cos(t);
B=sin(t);
for i=1:numel(t)
C(:,i)=A(i).*B(:);
end
surf(C);
xlabel('x axis','fontsize',12)
ylabel('y axis','fontsize',12)
zlabel('z axis','fontsize',12)
title ('3D Plot')
That is almost what I need, for some reason the chart is plotting x and y from 0 to 80, and Im not sure why. I there another way I can try plotting this so that I can use different variables for the cosine and sine inputs?:
forloop withC = B' * A;. Just replace the entire loop fromfortillendwith this snippet, the result will be the same. - scenia