Given a function 𝑧(𝑥,𝑦)=10sin 𝑡.where 𝑡=√𝑥2+𝑦2.
Create a figure containing of twodifferent three-dimensional subplots (i.e. mesh and contour plots) of the function 𝑧(𝑥,𝑦)where both 𝑥 and 𝑦 are ranging from -10 to 10. For both subplots, label the axes and showthe color bar to identify the variation of z.
x=linspace(-10,10);
y=linspace(-10,10);
t=sqrt(x.^(2)+y.^(2));
Z = 10*sin(sqrt(x.^(2)+y.^(2)));
%graphing
figure(1)
mesh(Z);
xlabel('x')
ylabel('y')
zlabel('10 sin(t)')
figure(2)
contour3(Z);
xlabel('x')
ylabel('y')
zlabel('10 sin(t)')
What went wrong actually?
No graph were plotted when run

 采纳的回答

x=linspace(-10,10);
y=linspace(-10,10) .'; %CHANGED
t=sqrt(x.^(2)+y.^(2));
Z = 10*sin(sqrt(x.^(2)+y.^(2)));
%graphing
figure(1)
mesh(Z);
xlabel('x')
ylabel('y')
zlabel('10 sin(t)')
figure(2)
contour3(Z);
xlabel('x')
ylabel('y')
zlabel('10 sin(t)')

更多回答(0 个)

类别

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by