Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wynik = minY(x)
- %UNTITLED3 Summary of this function goes here
- % Detailed explanation goes here
- stala = x;
- f=@(y) 2.*stala.^2+y.^2+stala.*y-6.*stala-5.*y+8;
- a = -5;
- b = 5;
- e = 0.000001;
- x1=a+0.382*(b-a);
- x2=a+0.618*(b-a);
- while (b-a)>e
- if (f(x1)<f(x2))
- b=x2;
- else
- a=x1;
- end
- x1=a+0.382*(b-a);
- x2=a+0.618*(b-a);
- end
- wynik=(a+b)/2;
- end
Add Comment
Please, Sign In to add comment