MATLAB: 3D surface (sine wave)

sine wave

Hello, How can I create 3D surface (sine wave)and plote it? Thank you very much

Best Answer

One possibility is to use the following:
k1 = 1; %how many times you want wave to oscillate in x-dir
k2 = 0; %how many times you want wave to oscillate in y-dir
[X,Y] = meshgrid(linspace(-pi,pi));
Z = cos(k1*X).*cos(k2*Y);
Change k1 and k2 for fun.