フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

this code is giving same values of x irrespective of change in the power of xdata in fun???i am changing power 0.5 to 0.9 no change in output??

1 回表示 (過去 30 日間)
ash
ash 2018 年 4 月 13 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
xdata =[10.^(-5) 10.^(-4) 10.^(-3) 10.^(-2) 10.^(-1) 1];
ydata=(0.2575./((xdata.^2)+(0.333.*xdata)+1));
fun=@(x)sum(x(1)./((x(2).*xdata.^1.5+x(3).*xdata.^0.5+1)- ydata).^2);
rng default % For reproducibility
nvars = 3;
LB = [0.2;0.2; 0.2];
UB = [5; 5; 5];
options = optimoptions('particleswarm','SwarmSize',50,'HybridFcn',@fmincon);
x = particleswarm(fun,nvars,LB,UB,options)

回答 (1 件)

John D'Errico
John D'Errico 2018 年 4 月 13 日
The answer is always to think clearly about what you did. Look at the numbers.
xdata =[10.^(-5) 10.^(-4) 10.^(-3) 10.^(-2) 10.^(-1) 1];
ydata=(0.2575./((xdata.^2)+(0.333.*xdata)+1));
ydata =
0.2575 0.25749 0.25741 0.25662 0.24681 0.11037
So almost all of ydata is CONSTANT. All but one element was virtually the same identical value. So you are trying to fit a curve that has essentially only two pieces of information in it.
fun=@(x)sum(x(1)./((x(2).*xdata.^1.5+x(3).*xdata.^0.5+1)- ydata).^2);
Almost all of xdata are tiny numbers, then raising it to a power makes it even smaller. But as well, it becomes effectively unimportant in the computation. You won't see much difference if you use xdata.^1.5 or xdata.^2 in the fit.
I cannot show you exactly what happens, because I don't have that toolbox.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by