Question: A general Step Function not with the right plot

A complicated programmed task for me
I must analyze this 

In this plot there are vertical  walls connected with the step area's , but that its not wanted.
Also the domain is showed by adding 0 in the plot 3d( {0, 'g(x,y)'}, ...) and this distract the plot with the step area's
Its not needed the domain in the plot ( in order to get the 0 value for z )     

The 3 axis x,y,z  are not visible in the plot 
Seems to be not complete programmed as it just to be.


 

> 

restart

> 

 

> 

f:=proc(A,B,T,x,y)

> 

     local n,m,i,j,val;

> 

     n:=nops(A);m:=nops(B);

> 

       for i from 1 to n-1 do

> 

         for j from 1 to m-1 do

> 

         if (A[i]<=x and x<A[i+1]) and

> 

            (B[j]<=y and y< B[j+1]) then val:=T[i,j];

> 

         end if;

> 

          end do;

> 

       end do;

> 

     val;

> 

   end proc:

> 

 

> 

 

> 

A:=[0,1,2];B:=[0,1,2];T:=array([[1,2],[1.5,1]]);

A := [0, 1, 2]

 

B := [0, 1, 2]

 

array( 1 .. 2, 1 .. 2, [( 2, 1 ) = (1.5), ( 1, 1 ) = (1), ( 2, 2 ) = (1), ( 1, 2 ) = (2)  ] )

(1)
> 

 

> 

g:=(x,y)->f(A,B,T,x,y);

proc (x, y) options operator, arrow; f(A, B, T, x, y) end proc

(2)
> 

 

> 

plot3d({0,'g(x,y)'},x=0..2,y=0..2,axes=normal,
           scaling=constrained,orientation=[-37,75],
           projection=0.8,tickmarks=[3,0,2],
           shading=XYZ,lightmodel='light3');

 
> 

 


 

Download texc_set_4_-task_3_-forumvraag.mw

 

Please Wait...