How can I plot this function

1 visualización (últimos 30 días)
B.E.
B.E. el 16 de Oct. de 2019
Comentada: B.E. el 16 de Oct. de 2019
I want to plot this function in the interval
Thank you
  1 comentario
Sulaymon Eshkabilov
Sulaymon Eshkabilov el 16 de Oct. de 2019
Could you please show here what you've done so far?
General points: you'd need to employ logical indexing or [for .. end] or [while .. end] loop interation operators.
Good luck.

Iniciar sesión para comentar.

Respuesta aceptada

Fabio Freschi
Fabio Freschi el 16 de Oct. de 2019
Editada: Fabio Freschi el 16 de Oct. de 2019
You may use surf
% define a suitable number of x and y divisions. Here I used 200
x = linspace(0,10,200);
y = linspace(1,30,200);
% crate regular grid (xx and yy are 2d matrices)
[xx,yy] = meshgrid(x,y);
% you can also put your z function with if-else in a separate m-file
>> fun = @(x,y)(exp(-x.^2)+cos(pi*x))+(x>5).*log(y);
% evaluate your function
zz = fun(xx,yy);
% use surf to plot
figure,surf(xx,yy,zz)

Más respuestas (0)

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by