简体   繁体   中英

How to convert this into a 3D mesh plot?

I have the following code :

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);

I tried h=plot3(x,y,t) but the line itself remains in 2D .. Should I convert this into a matrix ?

Create a grid of points and then use mesh() :

[x,t] = meshgrid(x,t);
y     = a*sind(2*pi*f*(t+(x*T)/wl)); 
mesh(y)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM