I'm working on image denoising problem and I have develop an optimization algorithm in Matlab for this prupose. The images are in a 256 grey level scale so mathematically what I have is a map from the unit square into the reals. In order to numerically solve this problem I have divided the unit square into $n^{2}$ pixels and assume the grey value (the value of the function) to be constant in each pixel.
This isn't what we all known as an image, that roughly speaking is the projection of the grpahic of this map giving distinct grey values for distinct values of the function, we can name this to be the $\textit{real image}$.
And here comes the problem
I'm testing the algorithm with a few simple examples that I would like to present to a non necessarily expert audience so I would like to show them the graphic of my function and the real image, both together.
What I have done so far is draw the function using a mesh, that is, I have a vector $x\in \mathbb{R}^{n^{2}}$ containing the values of the pixels ordered by columns from bottom left to top right, and I do the following
subplot(2,2,1),mesh(reshape(x(1:n*n),n,n))
Wich leads me to the following graphics (this is just an example)

The axes are not equal but that has an easy solution that doesn't matter now.
But as I said, I want to show the image that this graphics represent, and for that I used
imshow(reshape(x(1:n*n),n,n))
And what I got was this

As you can see, this both images doesn't match, it seems like imshow is 'looking' at my image from below, because just the 'U' is flipped.
It isn't just rotated because the reversed 'U' stills in the left.
How can I force imshow to show the image like 'looking' from above? Or are there any other Matlab command that will perform better for this?
Thanks in advance.
THE FOLLOWING IS AN EDIT
I leave you the code used to generate the original image just in case you want to prove something.
z=zeros(40);
z(13:28,5:7)=ones(size(z(13:28,5:7)));
z(13:15,5:17)=ones(size(z(13:15,5:17)));
z(13:28,15:17)=ones(size(z(13:28,15:17)));
z(13:28,22:24)=ones(size(z(13:28,22:24)));
z(13:15,22:34)=ones(size(z(13:15,22:34)));
z(26:28,22:34)=ones(size(z(26:28,22:34)));
x= z(:);
Image coordinates in MATLAB use the following convention: the center of top-left pixel is at (1,1), y-axis points down, x-axis points to the right. This is why your image looks upside down.
flipudis what you need. It reflects the image vertically. Since it filps the whole image, naturally it will flip both U and C.By the way, this question would fit better on StackOverflow proper. It is more about MATLAB programming than mathematics.