Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: 1 variable Derrivative of 2 D function...but Error..why??
Replies: 1   Last Post: Dec 27, 2012 8:15 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Quynh Tram Nghuyen Thi

Posts: 37
Registered: 4/13/12
1 variable Derrivative of 2 D function...but Error..why??
Posted: Dec 27, 2012 11:28 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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:
m-file diff2.m:
function [du1]=diff2(Xi,Yi,Zi,X,Y,h)
if nargin<6; h=1e-4;end;
du1=(interp2(Xi,Yi,Zi,X+h)-interp2(Xi,Yi,Zi,X-h))/(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,X-h))/(2*h)
>>

WHY?? I DONT UNDERSTAND AT ALL.
ANYONE can give me any error in m-file??
Im waiting, all
thanks alot



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.