MATLAB: How do i plot a discontinuous function 3d plotsdiscontinuosfunctionsMATLAB Online Serverplotting Hi i need to plot in 3d the following function in matlab: f(x,y)= (x^2)/(x^2 – y^2) when |x| ≠ |y| 0 when |x| = |y| how should i do it? thx Best Answer Try this: f = @(x,y) ((x.^2)./(x.^2 - y.^2)) .* (abs(x) ~= abs(y)) [X,Y] = ndgrid(linspace(-1,1,150));figuresurf(X, Y, f(X,Y))grid onshading('interp')It will automatically be 0 when the logical condition is not met, so no specific test need be added for the equality condition. . Related SolutionsMATLAB: Plane y=x % plane z=x,figurehold onfsurf(@(x,y) x)% plane z = yfsurf(@(x,y) y)view(3) MATLAB: Help plotting with simple linespace and surf You were very close: you only forgot to change x to X and y to Y after you added meshgrid.x=linspace(0,2*pi);y=linspace(0, pi);[X,Y]= meshgrid(x,y);Z=sin(3*X).^2.*cos(4*Y).^3;surf(X,Y,Z)(next time, select your code and click the {}Code button to correctly format your code) Related QuestionSimplify(~(~(x | y) & ~(y | z)))How do i plot a 3d function and a 2d curve togetherWriteaMALTABscriptfileforplottingthebelowsurfacesbycoloringthesurfacewithacolormap, appropriately naming the axis and titling the plot. 1. z = sin(x+y)/ x^2+y^2 for (x,y) ∈ [−2,2]×[1,3]Draw 3D object.write code in 2016a version. Help me,thanks!How to use meshgrid and contourError using mesh, Z must be a matrixHelp to plot a Surface plot of: z = y sin x – x cos y
Best Answer