From: Frédéric Bergeron on
Hi all,

I'm programming a GUI for leveling field and I want to produce leveling plan. In order to accomplish that, I have the topography data for a lot of points in the field and I want a clean X-Y view from the sky of the field. The problem is that the field is not "aligned" with x or y axis (presence of NaN data in the matrix corners), so the contour of the field looks irregular from the above. Is there a way to fix that?

Here's a simplified code sample of my problem:

%Field topographic data
x=1:20; y=1:20;
[xgrid,ygrid]=meshgrid(x,y);
zgrid=rand(20,20);
zgrid(ygrid>xgrid+5)=NaN;zgrid(ygrid<xgrid-5)=NaN;
zgrid(ygrid<-xgrid+4)=NaN;zgrid(ygrid>-xgrid+32)=NaN;

%Plotting
figure(1);
h_axes=axes('position',[0.1 0.1 0.8 0.8]);
surf(xgrid,ygrid,zgrid);

%X-Y view
cameraposition=get(h_axes,'cameraposition');
cameratarget=get(h_axes,'cameratarget');
cameraposition=[cameratarget(1) cameratarget(2) cameraposition(3)];
set(h_axes,'cameraposition',cameraposition);

Thanks in advance,
Best regards,
Fred
From: someone on
"Frédéric Bergeron" <frederic.bergeron(a)logiag.com> wrote in message <i1f301$fm6$1(a)fred.mathworks.com>...
> Hi all,
>
> I'm programming a GUI for leveling field and I want to produce leveling plan. In order to accomplish that, I have the topography data for a lot of points in the field and I want a clean X-Y view from the sky of the field. The problem is that the field is not "aligned" with x or y axis (presence of NaN data in the matrix corners), so the contour of the field looks irregular from the above. Is there a way to fix that?
>
> Here's a simplified code sample of my problem:
>
> %Field topographic data
> x=1:20; y=1:20;
> [xgrid,ygrid]=meshgrid(x,y);
> zgrid=rand(20,20);
> zgrid(ygrid>xgrid+5)=NaN;zgrid(ygrid<xgrid-5)=NaN;
> zgrid(ygrid<-xgrid+4)=NaN;zgrid(ygrid>-xgrid+32)=NaN;
>
> %Plotting
> figure(1);
> h_axes=axes('position',[0.1 0.1 0.8 0.8]);
> surf(xgrid,ygrid,zgrid);
>
> %X-Y view
> cameraposition=get(h_axes,'cameraposition');
> cameratarget=get(h_axes,'cameratarget');
> cameraposition=[cameratarget(1) cameratarget(2) cameraposition(3)];
> set(h_axes,'cameraposition',cameraposition);
>
> Thanks in advance,
> Best regards,
> Fred

What do you mean by a "clean X-Y view from the sky" that you don't have already?
Do you want to darw a boundary?
Replace the NaNs with a value?
Something else?
From: Frédéric Bergeron on
"someone" <someone(a)somewhere.net> wrote in message <i1f7ob$qha$1(a)fred.mathworks.com>...
> What do you mean by a "clean X-Y view from the sky" that you don't have already?
> Do you want to darw a boundary?
> Replace the NaNs with a value?
> Something else?

Hi, thanks for the answer, I'll try to add details to what I want:

What I want is to draw the 4 boundary lines (that will then represents a 45 degress turned rectangle) of the field, and if possible, fill the surf plot to those 45 degress lines by interpolating the color of the surf plot to the little triangles that will be created all along the boundary between the new boundary straight lines and the actual segmented horizontaly and verticaly boundary of the surf plot.

A "clean X-Y view from the sky" means that I want to view a colored filled rectangle with straight lines turned 45 degrees (this angle will be a variable) according to the coloring of the surf plot. The topographic data comes from a rectangular field, so I just want a rectangle with straight lines, all filled with color according to the surf plot, to represent more efficiently the actual field.

Hope it helps, and sorry for my english mistakes, it is my second language.
 | 
Pages: 1
Prev: fft amplitude in mV
Next: Removing columns