title: Curve fitting using a equation that involves a integral that isnt possible to solve analytically?
body: <p>I'm trying from 2 days to curve fit some data that I have using this equation</p>
  
  <pre><code>f = @(x) ((x.^4) .* exp(x)) ./((exp(x)-1).^2);
  gama*x + 9*R*((x/a)^3)*quad(f,0,a/x);
  </code></pre>
  
  <p>Here x is independent variable and a is unknown, gama is known. I tried the following procedure with the most success.</p>
  
  <pre><code>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
  
  
  &gt;&gt;fit(T_0,C_0,fittype('myquad(a,x)'));
  </code></pre>
  
  <p>It returned following error</p>
  
  <p>??? NaN computed by model function, fitting cannot continue. Try using or tightening upper and lower bounds on coefficients.</p>
  
  <p>Error in ==> fit at 443 errstr = handleerr( errid, errmsg, suppresserr );</p>
  
  <p>No idea what to do. Please guide..</p>