MATLAB Answers

how to remove the error

조회 수: 2(최근 30일)
Yusuf Muhammad Khan
Yusuf Muhammad Khan 5 Nov 2019
the error:
Error in fminbnd (line 233)
x= xf; fx = funfcn(x,varargin{:});
Error in untitled (line 5)
minr = fminbnd(@areaR,0,10),
my code:
%% Q11
global V
V = 10;
minr = fminbnd(@areaR,0,10),
minh = (3*V/(pi*minr^2)),
minA = areaR(minr),
r = 1:0.1:5;
A = areaR(r);
Ua = minA+0.1*minA;
Lr = r(A < Ua & A >minA);
Range_r = max(Lr) - min(Lr)

  댓글 수: 1

Walter Roberson
Walter Roberson 5 Nov 2019
You do not show us the complete error message and you do not show us the code for areaR

로그인 to comment.

답변 수 (1)

Urmila Rajpurohith
Urmila Rajpurohith 12 Nov 2019
Hi Yusuf
As you mentioned
error in fminbnd (line 233)
x= xf; fx = funfcn(x,varargin{:};
probably you would have got error message saying: “User supplied objective function must return a scalar value.”
It means the variable “fx” accepts only scalar values.
In this case the “funfcn” is “@areaR” which is not resulting a scalar output.So try to modify the “areaR” function so that it will result a scalar output.

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by