HELP

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

HELP

Kordasch, Michaela

Hello there,

 

I need help with an simple Octave Code, which shows me this error:

 

>> a=numgrad(y,2)

error: 'x' undefined near line 27 column 5

error: called from

    y at line 27 column 4

 

 

for the following function:

 

function a = numgrad (fname,x)

  h=10^(-8);

  n=length(x);

  for i=1:n

    a(i)=(feval(fname,x+h*einheitsvektor(n,i))-feval(fname,x-h*einheitsvektor(n,i)))/(2*h);

    end

 

 

Thank you!

Reply | Threaded
Open this post in threaded view
|

Re: HELP

Doug Stewart-4


On Fri, May 18, 2018 at 9:57 AM, Kordasch, Michaela <[hidden email]> wrote:

Hello there,

 

I need help with an simple Octave Code, which shows me this error:

 

>> a=numgrad(y,2)

error: 'x' undefined near line 27 column 5

error: called from

    y at line 27 column 4

 


you must have a function maned  y
Did you make a file called y.m?


 

 

for the following function:

 

function a = numgrad (fname,x)

  h=10^(-8);

  n=length(x);

  for i=1:n

    a(i)=(feval(fname,x+h*einheitsvektor(n,i))-feval(fname,x-h*einheitsvektor(n,i)))/(2*h);

    end

 

 

Thank you!




--
DASCertificate for 206392