how to remove the error
1 回表示 (過去 30 日間)
古いコメントを表示
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
clc;clear
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);
plot(r,A);
xlabel('r');
ylabel('Area');
Ua = minA+0.1*minA;
Lr = r(A < Ua & A >minA);
Range_r = max(Lr) - min(Lr)
1 件のコメント
Walter Roberson
2019 年 11 月 5 日
You do not show us the complete error message and you do not show us the code for areaR
回答 (1 件)
Urmila Rajpurohith
2019 年 11 月 12 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!