How to plot the following function in 3D ?

1 visualización (últimos 30 días)
Pardis
Pardis el 21 de Mzo. de 2014
Respondida: Roger Stafford el 21 de Mzo. de 2014
Hello I want to plot f(x,y)=2+0.1(x)+0.008(x+y)^2+sin(x-y)so my code line is
clear x=0:0.2:10; y=0:0.2:10; [xgrid, ygrid]=meshgrid(x,y); z=2+(0.1*xgrid)+0.008*(xgrid+ygrid).^2+sin.*(xgrid-ygrid); mesh(xgrid, ygrid, z) xlabel('x') ylabel('y') title('graph z=2+0.1.*xgrid+0.008.*(xgrid+ygrid).^2+sin.*(xgrid-ygrid')
but i keep getting an error for fifth line saying that not enough input arguments. i don`t understand what i have done wrong . if someone could help me i's be grateful. thanks.

Respuestas (1)

Roger Stafford
Roger Stafford el 21 de Mzo. de 2014
In that fifth line you have "sin.*(xgrid-ygrid)" instead of sin(xgrid-ygrid). The compiler can't find an argument for the 'sin' function, hence the error message.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by