Group Abstract Group Abstract

Message Boards Message Boards

[?] Perform a nonlinearmodelfit of data?

POSTED BY: Riccardo Moro
9 Replies
POSTED BY: Daniel Lichtblau

Oh yes! Thank a lot !!

POSTED BY: Riccardo Moro

Riccardo,

minima are the maxima of the negative function! Let data be your data from above, then you can do:

maxIndx = First /@ FindPeaks[Last /@ data];
minIndx = First /@ FindPeaks[Last /@ -data];
ListLinePlot[data, ImageSize -> Large, Epilog -> {PointSize[.01], Red, Point[data[[maxIndx]]], Green, Point[data[[minIndx]]]}]

which gives:

enter image description here

Regards -- Henrik

POSTED BY: Henrik Schachner

Well, forgive me for replying so late to your comment and for my bad english, yes you are rigth my analitycal model is correct but my data don't follow it (it is an experiment based on diffraction) cause of various problems even if i rescale the data, so in the end i have to analyse the data in other ways. Thank you all for the time you have invested and i have a final question: i can't find a function that find points of minimum ( of maximum is FindPeaks) from data does it exist or no? I can solve the problem with a Table but i was curious about the existance of this function. Thank again

POSTED BY: Riccardo Moro

You need to understand the model for your data, you can not just put almost random arbitrary rough functions and expect it to work. It is like fitting circle with a square and complaining it does not work. Nice advice given to you here by other member assumes that you will put more work into the details of the fit. Did you read any literature on fitting, and do you understand the mechanism behind your data? Many functions can fit your data, but they can be really far from the real mechanism behind the data, so they loose meaning. Are you sure you need an analytic model at all, maybe Interpolation would do for your goals? I got this "example" fit, notebook is attached. It fits twice: first a simple model, then fits residues of a simple model. It works with rescaled data: over x and y, you can easily rescale back. Rescaled data are easier to understand.

enter image description here

Attachments:
POSTED BY: Vitaliy Kaurov
POSTED BY: Riccardo Moro

Thank you all i try now

POSTED BY: Riccardo Moro

The Sinc function seems to be made for your problem. It is equivalent to Sin[x]/x when x is not 0, and it is 1 for x=0.

POSTED BY: Gianluca Gorni

Riccardo, try Sinc[x] instead of Sin[x]/x.

Regards -- Henrik

POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard