[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with functions

From: Sergei Steshenko
Subject: Re: Problems with functions
Date: Wed, 20 Jul 2016 13:51:51 +0000 (UTC)

> From: mat_hunt <address@hidden>
>To: address@hidden 
>Sent: Tuesday, July 19, 2016 11:37 PM
>Subject: Problems with functions
>I have defined a function:
>function  y=f(x)
>y=[y_1 y_2 y_3];
>and I have written a function to compute the Jacobian of that function:
>function J=jacobian(func,x)
>% computes the Jacobian of a function
>eps=1.e-8; % could be made better
>for i=1:n
>when I use the command:
>jacobian(f,[1 1 1])
>I get the error:
>error: 'x' undefined near line 2 column 5
>error: called from:
>error:   /home/mat/Matlab programs/f.m at line 2, column 4
>error: evaluating argument list element number 1
>What is going on? The code was working perfectly fine 10 minutes ago and now
>it's throwing up errors.
>View this message in context: 
>Sent from the Octave - General mailing list archive at

Your 'jacobian' function uses 'feval', and 'help feval' gives as an example

feval ("acos", -1)
=> 3.1416

, so jacobian("f",[1 1 1]) instead of jacobian(f,[1 1 1]) that you have might 
be better.

I.e. the rule of thumb I remember is that you either have a function handle or 
a function name as quoted string.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]