[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problems on minimum value of function
From: |
Martin Helm |
Subject: |
Re: problems on minimum value of function |
Date: |
Tue, 27 Mar 2012 15:40:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120312 Thunderbird/11.0 |
Am 27.03.2012 06:04, schrieb hayoun Woo:
> hi, I cannot solve this problem.
>
> No way to find code which can evaluate minimum value of these below.
>
> Q: Define a function hw1fun for y=x^2+x+1 and find the minimum value of the
> function for the interval
> 0<=x<=1
>
> I defined function as
>
> function y=hw1fun(x)
> y=x^2+x+1;
> end
>
> I tried to use [x,v]=fminbnd(@hw1fun,0,1) but it only works in MATLAB
>
> what is the similar code that uses in octave?
>
> I use octave 3.2.4 for windows
>
> please help me. I'm looking forward to get answer :)
>
Update to a newer version of octave, in 3.6.1 it works
[x v] = fminbnd(@(x) x^2+x+1, 0, 1)
x = 3.7377e-09
v = 1.0000