How to plot discontinous function f(x,y)

Please, how do I plot discontinous function of two variables: f(x,y)
z = f(x,y) = x-.8193318913*sin(x)*cos(x)/(cos(x)^2+sinh(y)^2)-(0.2931044702e-2*(0.7500000000e-3*x^2-0.7500000000e-3*y^2+0.1622336517e-1))*sin(x)*cos(x)/(((0.7500000000e-3*x^2-0.7500000000e-3*y^2+0.1622336517e-1)^2+0.2250000000e-5*x^2*y^2)*(cos(x)^2+sinh(y)^2))-0.4396567053e-5*x*y*sinh(y)*cosh(y)/(((0.7500000000e-3*x^2-0.7500000000e-3*y^2+0.1622336517e-1)^2+0.2250000000e-5*x^2*y^2)*(cos(x)^2+sinh(y)^2));

10 comentarios

Torsten
Torsten el 10 de Sept. de 2022
Why discontinuous ?
University Glasgow
University Glasgow el 10 de Sept. de 2022
I just wanna use this function as an example.
Sam Chak
Sam Chak el 10 de Sept. de 2022
Editada: Sam Chak el 10 de Sept. de 2022
It's a bit mathematically strange. Even if you want use this equation as an example, are the insignificant numbers necessary? I mean, why didn't you remove the insignificant zeros from the equation as you typed and then checked the equation?
By the way, can you point out the discontinuity in the equation? It probably makes the plotting easier.
University Glasgow
University Glasgow el 10 de Sept. de 2022
Sorry about that... I copied it from maple directly
Torsten
Torsten el 10 de Sept. de 2022
The usual way to plot a function z = f(x,y) is a surface plot.
Look up
for examples.
University Glasgow
University Glasgow el 10 de Sept. de 2022
Editada: University Glasgow el 10 de Sept. de 2022
Thank you for this. I know about this. I just wanna find out how plot f(x,y) that has discontinuity. For instance,
f(x,y) = 1/(x+1) + 1/(y-1)
Torsten
Torsten el 10 de Sept. de 2022
This function has no discontinuities. It is not defined for x = -1 and y = 0 and y = 1. Discontinuities can only appear in the domain where the function is defined.
To plot a function with singularities (like the one above), you must choose x and y such that they don't contain such singularities. Or you must return NaN from the function for those values of x and/or y where f has singularities. NaN values are not plotted.
University Glasgow
University Glasgow el 10 de Sept. de 2022
Please, how do I do that?
Torsten
Torsten el 10 de Sept. de 2022
Editada: Torsten el 10 de Sept. de 2022
f = @(x,y) 1./(x+1)+1./(y-1);
x = -2:0.05:2;
y = -2:0.05:2;
[X,Y] = meshgrid(x,y);
Z = f(X,Y);
Z(abs(Z)>1e2) = NaN;
surf(X,Y,Z)
University Glasgow
University Glasgow el 10 de Sept. de 2022
Thank you

Iniciar sesión para comentar.

Respuestas (1)

Chunru
Chunru el 10 de Sept. de 2022
syms x y z
f(x, y) = x-.8193318913*sin(x)*cos(x)/(cos(x)^2+sinh(y)^2)-(0.2931044702e-2*(0.7500000000e-3*x^2-0.7500000000e-3*y^2+0.1622336517e-1))*sin(x)*cos(x)/(((0.7500000000e-3*x^2-0.7500000000e-3*y^2+0.1622336517e-1)^2+0.2250000000e-5*x^2*y^2)*(cos(x)^2+sinh(y)^2))-0.4396567053e-5*x*y*sinh(y)*cosh(y)/(((0.7500000000e-3*x^2-0.7500000000e-3*y^2+0.1622336517e-1)^2+0.2250000000e-5*x^2*y^2)*(cos(x)^2+sinh(y)^2));
ezplot(f)

Categorías

Más información sobre Line Plots en Centro de ayuda y File Exchange.

Productos

Versión

R2022a

Preguntada:

el 10 de Sept. de 2022

Editada:

el 10 de Sept. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by