请调试并实现上图,请在同一窗口中显示。(提示:上图中实线为sin(2t)sin(9t);在下图中,函数应为Z= X/(2X a)Y,X的21个值均匀分布在5,50中,Y的31个值均匀分布在6.5,17.5中)。
要求:请显示主代码、功能代码和结果
clear all
clc
t = 0:0.01:pi;
f1 = sin(2*t).*sin(9*t);
f2 = sin(2*t);
t1 = linspace(0,pi,10);
f3 = zeros(1,10);
subplot(2,1,1);
plot(t,f1,'b-');
hold on
plot(t,f2,'r--');
hold on
scatter(t1,f3,'r');
xlabel('t');
ylabel('y');
subplot(2,1,2);
a = 3.6;
X1 = linspace(5,50,21);
Y1 = linspace(6.5,17.5,31);
[X,Y] = meshgrid(X1,Y1);
Z = X./(2*X+a).*Y;
surf(X,Y,Z);
xlabel('x');
ylabel('y');
zlabel('z');
legend('a=3.6');
title('3D mesh figure');