필터 지우기
필터 지우기

Curve fitting using a equation that involves a integral that isnt possible to solve analytically?

조회 수: 1 (최근 30일)
Hello there,
I'm trying from 2 days to curve fit some data that I have using this equation
f = @(x) ((x.^4) .* exp(x)) ./((exp(x)-1).^2);
gama*x + 9*R*((x/a)^3)*quad(f,0,a/x);
Here x is independent variable and a is unknown, gama is known. I tried the following procedure with the most success.
function C=myquad(a,T)
C = zeros(size(T));
gama = 20 * 1e-3;
R = 8.314;
f = @(x) ((x.^4) .* exp(x)) ./((exp(x)-1).^2);
for n = 1:length(T)
C(n) = gama*T(n) + 9*R*((T(n)/a)^3)*quad(f,0,a/T(n));
end
>>fit(T_0,C_0,fittype('myquad(a,x)'));
It returned following error
??? NaN computed by model function, fitting cannot continue. Try using or tightening upper and lower bounds on coefficients.
Error in ==> fit at 443 errstr = handleerr( errid, errmsg, suppresserr );
No idea what to do. Please guide..

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 7월 8일
dbstop if error
then inspect the variables being fed into your function. A good place to start at least.
  댓글 수: 1
simar
simar 2011년 7월 8일
thanks a lot i spotted out ..
i found that when i change the integral limits from 0 to 0.1 or so .. it is able to calculate. But I'm not sure whether my method for fit is right or not. I'm not getting the correct curves.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by