How to plot3D with inverse of matrix involved?

1 view (last 30 days)
I don't know what is worng with my code. Can someone figure this out? I plotted it on Wolfram Alpha and it's diffrent in MATLAB! The code is in the picture attached.

Answers (1)

Steven Lord
Steven Lord on 14 Nov 2019
Look at the X and Y limits on your MATLAB plot, then look at the X and Y limits on the plot from Wolfram Alpha.
MATLAB is giving you (a small section of) the same plot as Wolfram Alpha. Adjust your meshgrid call.
And FYI, instead of computing 2 * (denominator).^(-1) you could just use 2./denominator. That looks a little more like the original equation, doesn't it?
Once you have the adjusted plot, to prove to yourself that MATLAB got it right originally set the axes limits for the adjusted plot to the values they had in the plot in your screenshot above and compare with that screenshot.
axis([-2 2 -2 2 0 0.2])
They look pretty similar. Then restore the limits to their automatically chosen values to see the whole surface.
axis auto

Categories

Find more on Graphics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!