Inf Computed by model function

조회 수: 1 (최근 30일)
CP
CP 2011년 6월 21일
I'm trying to fit some data to the following model using fit and fittype:
model1=fittype('h*exp((-w*x)^2)*(sin(w*x))','independent,{'x'},'coefficients',{'h','w'});
When I try to do the fit I get the error message: Inf computed by model function, fitting cannot continue. Try using or tightening upper and lower bounds on coefficients.
I tried tightening them pretty tightly but I still get this error.
The data I'm trying to fit is this:
x: [-169.3662 -149.8015 -130.3560 -110.7559 -90.4435 -70.1957 -50.5075 -35.9124 -15.4939 10.7868 30.6151 50.4345 69.3836 89.8258 109.6690 130.0456 149.6947 169.9521]
y: [0.4029 -0.6778 -0.3065 -0.8638 -2.7271 -3.0545 -6.0058 -4.7192 0.2971 1.2499 2.0040 3.9745 3.0164 1.4674 2.5399 0.9531 0.3945 -0.1607]
Is there some option i can use to get this to work? Thanks!

채택된 답변

CP
CP 2011년 6월 21일
Oops never mind, I had a typo in my model with the parentheses. Negative sign was supposed to be outside the ()^2, otherwise the values become infinite real fast.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by