How to constrain the results calculated by "nlinfit" from complex number to real number?
    2 views (last 30 days)
  
       Show older comments
    
Hello everybody,
Recently I used the mathematic function "nlinfit" to execute the fit. Unfortunately, the results show that the fitting coefficients are complex number, which does not have a physical meaning of my model.
I know there is one way to just use the absolute value to get real number after the fitting. However, it is just a trick! So how can I constrain it to real number before starting the fitiing?
2 Comments
  Torsten
      
      
 on 4 Aug 2017
				You will have to constrain the parameters E and B such that T_b-T^0 remains positive.
Best wishes
Torsten.
  John D'Errico
      
      
 on 4 Aug 2017
				
      Edited: John D'Errico
      
      
 on 4 Aug 2017
  
			Taking the absolute value does not provide a useful solution anyway, since the result is not a minimum sum of squares of errors.
As Torsten said, you need to prevent that term from going negative or zero. This is not possible to do using nlinfit of course, since nlinfit does not allow that class of constraint on the parameters.
Answers (0)
See Also
Categories
				Find more on Nonlinear Regression in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

