MATLAB Answers


How to construct an anonymous function from the result of the fit command?

Asked by Federico
on 26 Dec 2013
Latest activity Commented on by Federico
on 26 Dec 2013
Accepted Answer by Matt J


I am trying to do some data fitting with a data set that resembles an air bubble when plotted. I am trying to obtain a function that defines the surface of the bubble. The following result perfectly fits the the profile.


Now, I would like to create an anonymous function. How can I accomplish this?

Thank you.



No products are associated with this question.

2 Answers

Answer by Matt J
on 26 Dec 2013
Edited by Matt J
on 26 Dec 2013
 Accepted answer

 anonf=@(x) f(x)

  1 Comment

Wow, that was easy enough. Thank you very much!

Answer by The Matlab Spot on 26 Dec 2013
Edited by The Matlab Spot on 26 Dec 2013

Refer Anonymous Functions for further details


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!