フィルターのクリア

How to fit a function with mutiple variables

3 ビュー (過去 30 日間)
Tuan-Tu
Tuan-Tu 2016 年 6 月 21 日
編集済み: Tuan-Tu 2016 年 6 月 21 日
Hello everyone,
I have a problem related to the fitting of a function which contains multiple variables. I usually use the command lsqcurvefit to fit a function with only one varibales such as times (y = f(t)) but this time the function that I have to fit turns to this :
y = f(alpha*x,t)
x is a vector calculed from 2 look-up tables a and b. And we have a,b vary with times
t = [0 : 30 : 9000]
My goal is to find alpha for each value of a and b because later I want to create a look-up table of alpha that match with a and b. If I'm correct, it means at each step of times, I have to find an alpha that allows having a best fit of f with the curve between y(i) and y(i-1).
I tried to do this with a for loop but it doesn't work so I want to know your advises for my problem. May be I'm wrong from the beginning.
a = ([0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100])/100;
b = [-20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 60] ;
x = interp2(a,b,x_out,a_measure,b_measure) ;
A = (1/Rth_int)+(1/Rth_ext) ;
fitfun =@(alpha,times) (Temp_init-(A*Temp_ext+alpha*x.*(Imp.^2))/A).*exp(-(A*times)/(masse*Cp)+((Temp_ext*A+alpha*x.*(Imp.^2))/A);
May be I don't explain well the problem so if you guys have any questions please let me know. Thanks a lot.

回答 (1 件)

Jos (10584)
Jos (10584) 2016 年 6 月 21 日
So you're fitting a surface in 3D space, z = f(x,y)
  1 件のコメント
Tuan-Tu
Tuan-Tu 2016 年 6 月 21 日
編集済み: Tuan-Tu 2016 年 6 月 21 日
Thank for your answer but I'm not sure because my output parameter y is just a vector size 308*1. I tried to plot a surface in fonction of x and time but it doesn't work. You know how could I do this ? Thank you

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

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by