Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-401. Error in fminsearch (line 200) fv(:,1) = funfcn(x,varargin{:});
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Arbenit Kryeziu
le 18 Fév 2019
Réponse apportée : mohammad hodaei
le 18 Déc 2019
zahl = [1:1:401];
fun_normal = @(x)(normpdf(zahl,x(1),x(2)) + unifpdf(zahl,0,x(3)));
x0=[max(zahl),5,30];
x = fminsearch(fun_normal,x0);
0 commentaires
Réponse acceptée
Patel Mounika
le 21 Fév 2019
The objective function (first input argument of "fminsearch") should return a scalar value to be minimized. However, the function "fun_normal" used in the code doesn’t return scalar value. So, try redefining the function such that it returns a scalar value to use fminsearch.
0 commentaires
Plus de réponses (1)
mohammad hodaei
le 18 Déc 2019
please let me know how did you fix the code finally? I have the same problem.
Thanks
M.H.
0 commentaires
Voir également
Catégories
En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!