フィルターのクリア

lscurve fit problem issue in Money Rivlin model

9 ビュー (過去 30 日間)
SATYA PAL
SATYA PAL 2023 年 2 月 20 日
コメント済み: Star Strider 2023 年 2 月 23 日
Hello,
I have got a function with respect to different variables. I want to make sum of that function with respect to the variables. my equations are
fun1=@(a,x1) a(1).*(2*x1-2./x1.^2)+a(2).*(2-2./x1.^3)+a(3).*(6* x1.^2-6*x1-6./x1.^4+6./x1.^3 +6./x1.^2-6)
and
fun2=@(a,x2) a(1).*(2*x2)+a(2).*(2*x2)+a(3).*(4*x2.^3)
I want to add fun1 and fun2
fun_sum= @(a,x1,x2) fun(a,x1)+ fun(a,x2)
now by applying lscurvefit I want values of a(1), a(2) and a(3)
I am looking forward for reply
  1 件のコメント
SATYA PAL
SATYA PAL 2023 年 2 月 20 日
please share the code if possible

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2023 年 2 月 20 日
I am not certain what you want to do.
Two independent variables may require one or two dependent variables, however with only one dependent variable, it will need to be duplicated to two columns (assuming all data are column-oriented) —
fun1=@(a,x1) a(1).*(2*x1-2./x1.^2)+a(2).*(2-2./x1.^3)+a(3).*(6* x1.^2-6*x1-6./x1.^4+6./x1.^3 +6./x1.^2-6);
fun2=@(a,x2) a(1).*(2*x2)+a(2).*(2*x2)+a(3).*(4*x2.^3);
fun12 = @(a,x1x2) [fun1(a,x1x2(:,1)) fun2(a,x1x2(:,2))];
x1x2 = rand(12,2);
y1y2 = rand(12,2);
B0 = rand(3,1);
B = lsqcurvefit(fun12, B0, x1x2, y1y2) % Two Dependent Variables
Local minimum found. Optimization completed because the size of the gradient is less than the value of the optimality tolerance.
B = 3×1
-0.0744 0.0176 -0.0004
y1y1 = [1 1].*y1y2(:,1); % Duplicate First Column
B = lsqcurvefit(fun12, B0, x1x2, y1y1) % One Dependent Variable, Duplicated
Local minimum found. Optimization completed because the size of the gradient is less than the value of the optimality tolerance.
B = 3×1
-0.0865 0.0210 -0.0004
.
  20 件のコメント
SATYA PAL
SATYA PAL 2023 年 2 月 23 日
Thanks a lot Sir
Star Strider
Star Strider 2023 年 2 月 23 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by