
1 variable Derrivative of 2 D function...but Error..why??
Posted:
Dec 27, 2012 11:28 AM


Hello all, very glad to see the room back. May i start a question about DERRIVATIVE. Problem: Compute DERRIVATIVE of FUNCTION U(x,y) by 1 variable x , domain 2D:RxR I did: mfile diff2.m: function [du1]=diff2(Xi,Yi,Zi,X,Y,h) if nargin<6; h=1e4;end; du1=(interp2(Xi,Yi,Zi,X+h)interp2(Xi,Yi,Zi,Xh))/(2*h)
EXAMPLE on command window: x=1:8; >> y=1:4; >> [u,v]=meshgrid(x,y) z=peaks(u,v)
diff2(u,v,z,u,v)
===>>>ERROR:Error using ==> interp2 at 140 Wrong number of input arguments.
Error in ==> diff2 at 6 du1=(interp2(Xi,Yi,Zi,X+h)interp2(Xi,Yi,Zi,Xh))/(2*h) >>
WHY?? I DONT UNDERSTAND AT ALL. ANYONE can give me any error in mfile?? Im waiting, all thanks alot

