find minimum of function with four variables using simplex search method of nelder and mead
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/630480/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/630485/image.png)
Hi community. Please help me. Following is the code I have written, but it does not work and is showing an error.
Failure in initial objective function evaluation. FMINUNC cannot continue.
My code is:
close all; clc; clear all;
syms p1 p2
f=@(D) 0.008*D^-1/3
Q=@(p1,p2,D,L)3.39*(((p1^2-p2^2)*D^5)/f*L)^1/2==100*10^6/24;
p1=solve(Q,p1)
r=p1/p2;
f=@(D,p1,L,r) 7.84*D.^2*p1+450000+36900*D+6.57*10.^6/L+(772*10.^6/L)*(r.^0.219-1)
x0=[1 1];
[x_MIN,f_MIN]=fminunc(f,x0)
f=@(D,p1,L,r) -(7.84*D.^2*p1+450000+36900*D+6.57*10.^6/L+(772*10.^6/L)*(r.^0.219-1));
x0=[-1 -1];
[x_MAX,f_MAX]=fminunc(f,x0)
1 comentario
Star Strider
el 26 de Mayo de 2021
Note — The Nelder-Mead algorithm is implemented in the fminsearch function.
Respuestas (1)
Sulaymon Eshkabilov
el 26 de Mayo de 2021
Hi,
There are some variables undefined in your defined function handle f.
0 comentarios
Ver también
Categorías
Más información sobre Calculus en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!