I am trying to do a surface plot of a 3D function
at slice
(which corresponds to time = 1). To do so I create a grid with
and
. Here's the code: [W, Theta] = meshgrid(grid(1, :), grid(2, :));
surf(W, Theta,reshape( u(2, :, :), N, N), 'EdgeColor','none');
xlabel("$x$", 'Interpreter','latex');
ylabel("$p$", 'Interpreter','latex');
I obtain:
Notice this discontinuity at x = 1.5 for example along the p-axis. This is a close up view from above, and one from the side.
However, if I plot just a slice using the normal plot function in matlab there is no discontinuity. Here's the code and the plot:
plot(grid(2, :), reshape(u(2, 40, :), 50, 1)); xlabel('p'); ylabel('u(x = 1.59, p)')
here index 40 corresponds to x = 1.59.
Does anybody know what is going on in here? Any help/hint would be greatly appreciated!!