default fit curve not correct

Hello,

I had a strange curve-fitting problem which I don't know the reason.
I tried to fit a curve with a user defined function through the fitting dialog.
The User defined function contains some Global waves.
When I run the fit, it seemed everything works except that the default fit curve that automatically append to the figure is not the right one.
Since it does not fit the original curve at all. The strange thing is that the residual wave shows quite good fit.
Also, if I make and chose the destination wave and append it to the graph, it fit the original curve quite well.

As shown in the figure and files that attached.

Anyone knows the reason?

Thanks a lot in advance!

Yujin

Why.pxp (140.59 KB) test_proc.ipf (4.13 KB)
I wonder … Is the wave altered (e.g. normalized) internally in the fit function and then never re-scaled back to its "proper" height?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Your final assignment to yw is essentially assuming that you know how many points are in yw. When the /D flag is used alone to make the default fit curve ("autodestination" wave) you get by default a 200-point wave with evenly spaced X values.

It can be quite difficult to make a fit function like yours work correctly with the autodestination wave. Be sure to read carefully the second example ConvFit function in

DisplayHelpTopic "All-At-Once Fitting Functions"

An alternative is to use /D= instead of /D alone. In that case, you provide a fit wave that matches your input data exactly. Your fit function will not have to deal with waves having unexpected characteristics. I see that you have done that with your wave RealFitWave.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thanks for your reply, Jjweiner.
I checked this, but it should not be the reason.
Possiblely, @johnweeks is right, the default number of data point might be the reason.
I would check this now.


jjweimer wrote:
I wonder … Is the wave altered (e.g. normalized) internally in the fit function and then never re-scaled back to its "proper" height?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville

Johnweeks, thank you so much!

I would check this data-point issue now.
For this "All-at-Once fitting", I can figure out how to circumvent this problem.
But in the Global_fit dialog, there is no such option.
Fortunately, the global fit optical pop-up a new graph indicates that my fitting works.
I would like to know, is there any similar solution for this Global_analysis package?
Do you think my problem can be solved by modifying my Fit_Function or not?

Thanks again?

Yujin

johnweeks wrote:
Your final assignment to yw is essentially assuming that you know how many points are in yw. When the /D flag is used alone to make the default fit curve ("autodestination" wave) you get by default a 200-point wave with evenly spaced X values.

It can be quite difficult to make a fit function like yours work correctly with the autodestination wave. Be sure to read carefully the second example ConvFit function in

DisplayHelpTopic "All-At-Once Fitting Functions"

An alternative is to use /D= instead of /D alone. In that case, you provide a fit wave that matches your input data exactly. Your fit function will not have to deal with waves having unexpected characteristics. I see that you have done that with your wave RealFitWave.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com

tyjhit wrote:
But in the Global_fit dialog, there is no such option.
Fortunately, the global fit optical pop-up a new graph indicates that my fitting works.

Indeed, Global Fit assumes that your fitting function will behave correctly with any destination wave.
Quote:
I would like to know, is there any similar solution for this Global_analysis package?

There is no solution other than modifying the Global Fit code. It would not be easy to do.
Quote:
Do you think my problem can be solved by modifying my Fit_Function or not?

In general, yes, it is always possible to write your fit function to properly handle the autodestination wave. But it can be quite tricky. Since you say that the final result of Global Fit is correct, it may not be worth the trouble.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thanks again, johnweeks!

Your comments are quite helpful!

Yujin


johnweeks wrote:
tyjhit wrote:
But in the Global_fit dialog, there is no such option.
Fortunately, the global fit optical pop-up a new graph indicates that my fitting works.

Indeed, Global Fit assumes that your fitting function will behave correctly with any destination wave.
Quote:
I would like to know, is there any similar solution for this Global_analysis package?

There is no solution other than modifying the Global Fit code. It would not be easy to do.
Quote:
Do you think my problem can be solved by modifying my Fit_Function or not?

In general, yes, it is always possible to write your fit function to properly handle the autodestination wave. But it can be quite tricky. Since you say that the final result of Global Fit is correct, it may not be worth the trouble.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com