custom equation fitting and plotting

3 visualizaciones (últimos 30 días)
aditi
aditi el 17 de Sept. de 2014
Comentada: Michael Haderlein el 17 de Sept. de 2014
I have about 10 data files... i have to fit a equation (like power law) on each of them and finally plot the original plot and the fitted plot on the same plot for all 10 files... plz help

Respuesta aceptada

Michael Haderlein
Michael Haderlein el 17 de Sept. de 2014
What part of the task is the problem?
The fit function has a very good example with this census data from which you can start to develop the fitting.
The plot function also works with the fit result. With hold all, you can plot multiple data series in the same axes.
Finally, with subplot you can easily create and arrange multiple axes on one figure.
  2 comentarios
aditi
aditi el 17 de Sept. de 2014
thanks for replying.. could you please help me out with the outline of code.. m new to MATLAB
like suppose i have 2 files with x and y coordinates.. and on each of them i have to fit y=ax^(b) and find a and b.. finally i have to plot both the fits on the same plot.. please help me with the code
Michael Haderlein
Michael Haderlein el 17 de Sept. de 2014
My original answer actually provides a step-by-step protocol on how to solve this. In the link it is described how to read a sequence of files. In short, get all the files and loop over them. In each iteration, get the file name and read the file. Then you have the data you need. Second, use the data for fitting. For this, you can start with this example as I have written. Finally, you just need to plot it. Also described above.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by