我有以下代码:
a=7
f=10
T=1/f;
v=40
wl=v/f;
x1=1;
x2=30
step=0.01
t=x1:step:x2;
x=x1:step:x2;
y=a*sind(2*pi*f*(t+(x*T)/wl));
h=plot(x,y);
我试过了h=plot3(x,y,t)
,但这条线本身仍然是2D。我应该把它转换成矩阵吗?
答案 0 :(得分:1)
创建点网格,然后使用mesh()
:
[x,t] = meshgrid(x,t);
y = a*sind(2*pi*f*(t+(x*T)/wl));
mesh(y)