help-octave
[Top][All Lists]
Advanced

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

Re: error with function handles


From: Jaroslav Hajek
Subject: Re: error with function handles
Date: Wed, 19 Aug 2009 15:03:18 +0200

On Wed, Aug 19, 2009 at 2:50 PM, simone marras<address@hidden> wrote:
> Hi everyone, thanks for helping.
>
> I corrected the errors that you pointed out but still obtained exactly
> the same error that I would get initially. To summarize the steps,
> this is what we have:
>
> 1)
>
>>> function y = fun(x)
>  >   y = 10*exp(-50.0*abs(x));
>>    endfunction
>>>
>
> 2)
>
> function int = midpntc(a, b, m, fun)
>
>        h=(b-a)/m
>        x=[a+h/2:h:b];
>
>        k = max(size(x));
>
>        y = fun(x);
>
>        if size(y) == 1, y = diag(ones(k))*y; end
>
>        int = h*sum(y);
> end
>
> 3) And finally, call to midpntc as:
>
> octave:72> midpntc(0, 1,10, @fun)
> h =  0.10000
> error: octave_base_value::convert_to_str_internal (): wrong type
> argument `function handle'
> error: eval: expecting std::string argument
> error: evaluating assignment expression near line 13, column 4
> error: called from `midpntc' in file
> `/home/simone/Documents/scientific/CFD/myCFD_library/ATMOSPHERE_miscellanea/TMP/midpntc.m'
>
>
> I am lost
> S.
>
>

Works for me. You're screwing up something - make sure you saved all
files and no old versions are getting in the path.



-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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