필터 지우기
필터 지우기

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{:});

조회 수: 3 (최근 30일)
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);

채택된 답변

Patel Mounika
Patel Mounika 2019년 2월 21일
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.

추가 답변 (1개)

mohammad hodaei
mohammad hodaei 2019년 12월 18일
please let me know how did you fix the code finally? I have the same problem.
Thanks
M.H.

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by