simultaneous fitting of two plots with two functions

13 ビュー (過去 30 日間)
Arun Kumar Bar
Arun Kumar Bar 2018 年 9 月 16 日
コメント済み: Arun Kumar Bar 2018 年 9 月 25 日
I have two sets of dependent variable column vectors (y1, y2) for a set of independent variable column vectors (x). I want to fit the (x, y1) plot with the function f1(ca. f1 = (a + (b-a)*(1 + c*x^d))) and the (x, y2) plot with the function f2(ca. f2 = (b-a)*c*x^d)) simultaneously. Could anyone please help?
Many thanks, in advance! Arun
  2 件のコメント
Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan 2018 年 9 月 16 日
What do you mean by simultaneous? Based on your equations, the transformation from x to y_1 is independent of y_2 and likewise x -> y_2 is independent of y_1. So you can just fit the two functions separately.
Arun Kumar Bar
Arun Kumar Bar 2018 年 9 月 17 日
編集済み: Arun Kumar Bar 2018 年 9 月 17 日
The parameters a, b, c and d are to be same for both the fits. If I fit separately, it will not guarantee same values of the parameters for both the fits. Anyway, thank you.

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

採用された回答

Torsten
Torsten 2018 年 9 月 17 日
Use "lsqcurvefit" with the data set xdata = (x,x),ydata = (y1,y2).
Best wishes
Torsten.
  5 件のコメント
Torsten
Torsten 2018 年 9 月 25 日
... .*pi/2)))./(1+(2.* ...
instead of
... .*pi/2)))/(1+(2.* ...
Best wishes
Torsten.
Arun Kumar Bar
Arun Kumar Bar 2018 年 9 月 25 日
That's great! Thanks a lot, Torsten!
Kind regards, Arun

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

その他の回答 (1 件)

Torsten
Torsten 2018 年 9 月 17 日
xdata=[x(:,1); x(:,1)];
ydata=[y1(:,1); y2(:,1)];
fun=@(x,xdata) [f1(xdata(1:numel(xdata)/2),x(1),x(2),x(3),x(4)); f2(xdata(1:numel(xdata)/2),x(1),x(2),x(3),x(4))];
x0=[- - - -];
x=lsqcurvefit(fun,x0,xdata,ydata);
where f1(...),f2(...) must be column vectors each of the same size as x.

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by