MATLAB: Descending Axis Meshgrid Plotting

axisMATLABmeshgridplotplottingreverse

[EDIT: 20110512 16:59 – reformat – WDR]
Dear fellow MATLAB Users,
I am plotting data over a meshgrid, and would like to reverse the plotted "Y" axis from ascending to descending. For some reason, when changing my meshgrid parameters to allow for this, I am prompted with a 1×1 plotting window. Here is my code as it stands before making my alteration:
__________ CODE START __________
z=zeros(1,12);
xD=[1600;1666;1730;1780;1810;1800;1780;1770;1740;1720;1670;1610];
yD=[700;730;790;860;980;1030;1020;1100;1070;1030;970;930];
[x,y] = meshgrid(487:4:2074, 213:4:1106);
z_sum = 0*x;
h = surf(x,y,z_sum,'linestyle','none');
axis image
for i=1:numel(xD);
z=550 - 4.2*sqrt((x-xD(i)).^2+(y-yD(i)).^2);
z(z<0) = 0;
z_sum = z_sum + z;
set(h,'zdata',z_sum);
view([0 90])
drawnow;
pause(.01);
end
__________ CODE END __________
This will return my desired plot, with exception to a descending "Y" axis. This is how my code appears after alterating:
__________ NEW CODE START __________
z=zeros(1,12);
xD=[1600;1666;1730;1780;1810;1800;1780;1770;1740;1720;1670;1610]; yD=[700;730;790;860;980;1030;1020;1100;1070;1030;970;930];
[x,y] = meshgrid(487:4:2074, 1106:4:213);
z_sum = 0*x; h = surf(x,y,z_sum,'linestyle','none'); axis image
for i=1:numel(xD); z=550 - 4.2*sqrt((x-xD(i)).^2+(y-yD(i)).^2); z(z<0) = 0; z_sum = z_sum + z; set(h,'zdata',z_sum); view([0 90]) drawnow; pause(.01); end
__________ NEW CODE END __________
Notice how a 1×1 unit plot is created. I cannot understand why this is occurring, nor what to do to remedy it. Any help that could be lent to solve this issue would be greatly appreciated.
Thank you,
~ Chris

Best Answer

[EDIT: 20110512 16:57 - reformat - WDR]
Add set(gca,'ydir','rev').
z_sum = 0*x;
h = surf(x,y,z_sum,'linestyle','none');
axis image
for i=1:numel(xD);
z=550 - 4.2*sqrt((x-xD(i)).^2+(y-yD(i)).^2); % 2-D Gaussian Curve
z(z<0) = 0;
z_sum = z_sum + z;
set(h,'zdata',z_sum);
set(gca,'ydir','rev')
alpha(.8) % Plot Transparency (Dramatically Slows Output)
view([0 90]) % Plot orientation
drawnow;
pause(.01); % Plot time delay
end