How to fit a function with mutiple variables
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!