You will need to visualize the wave with 3D plot in this case. For example, you can use surf command for this.
x = [0:0.1:2*pi];
y = [0:0.1:2*pi];
[X,Y]=meshgrid(x,y);
kx=1;
ky=0.5;
w = 1;
for t=0:0.01:10
f1 = sin(kx*X +ky*Y - w*t);
f2 = sin(kx*X + ky*Y - w*t);
f = f1+f2;
surf(X,Y,f)
drawnow;
end
Update:
If you want two waves not in same direction you will need separate values for wave vector, e.g. for wave going along 30 degree kx1=sqrt(3)/2, ky1=1/2
, for wave going in 90 degree kx2=0, ky2=1
.
In addition, if you want wave line instead 3D plate than you can produce slice of sine plate in direction of some selected line.
For example, you want to receive slice in direction 45 degree (x = y).
First step is produce vectors of slice line points:
lx = 1/sqrt(2); % (lx,ly) - direction vector for slice line
ly = 1/sqrt(2);
r = [0:0.1:4*pi]; % parameter to produce line in parametric form
x = lx * r;
y = ly * r;
Than we will use these vectors as inputs for sine equations:
kx1=sqrt(3)/2;
ky1=0.5;
kx2=0;
ky2=1;
w = 1;
for t=0:0.01:10
f1 = sin(kx1*x + ky1*y + w*t);
f2 = sin(kx2*x + ky2*y + w*t);
f = f1+f2;
plot(r,f);
drawnow;
end
Of course, form of sine line will depend from direction of slice line and you can receive different waves for different slice directions.