So I have a one dimensional vector in MATLAB that contains the interpolation of a pde solution over a meshgrid that I defined. I am solving a pde system for a cylinder, and what I want is to plot a contourslice at a given time. I can do this perfectly with the following code:
x = linspace(-0.06,0.06,100);
y = linspace(-0.06,0.06,100);
z = linspace(0,0.252,100);
[X,Y,Z] = meshgrid(x,y,z);
Tintrp = interpolateTemperature(result,X,Y,Z,12);
V=reshape(Tintrp,size(X));
contourslice(X,Y,Z,V,[],[],[0 0.05 0.1 0.15 0.2 0.252],40);
There, my meshgrid has the size of my cylinder (0.06 radius x 0.252 height), then I interpolate result (object from pde toolbox) at the index of 12, which represents a certain time. Then I adequate the interpolation to the size of my grid and I get the graph that I am looking for: Contourslice plot
Now, what I'd like to do is to threshold all the values in V that are greater than 0 and replace them with 0. For what I've read, I would accomplish that with:
V(V>0)=0;
But to my surprise, what happens when I insert that line of code before plotting is that somehow my volume gets "shrinked" and I see sort of the same figure that I attached above but the dimensions do not relate, here is the output: Contourslice plot
So it looks like it worked when you check the scale, but when you look at the axis then you notice something is off. What is also curious about this is that the higher the threshold I ask for (say, V(V>5)=5), the closer the shape gets to the first one. Does anybody have any idea on how to tackle this? Or if I am using any of the functions in the wrong way? Thanks! Leandro