Exporting Curves to Density Plot

2 vues (au cours des 30 derniers jours)
Kendall Cooney
Kendall Cooney le 3 Oct 2021
Commenté : Kendall Cooney le 27 Oct 2021
I have a few curve-fitting objects from applying a Gaussian fit to a histogram as shown below. The curves come out fine, but I'm now trying to save those curve values and turn them into a "density" plot (birds eye view of multiple histograms). Any advice on how to save these data values so I can use them in another graph?
f = fit(x,y,'gauss1');

Réponse acceptée

Abhiroop Rastogi
Abhiroop Rastogi le 27 Oct 2021
Hi Kendall,
You can extract the data from the curve variable "f", obtained using the "fit" function, by using the coefficients that are stored in the variable "f", as shown in the example below. The values of the coefficients "a1", "b1", and "c1" can be extracted using the notation "f.a1", "f.b1", and "f.c1" respectively.
x = randn(100,1);
y = randn(100,1);
f = fit(x,y,'gauss1')
f =
General model Gauss1: f(x) = a1*exp(-((x-b1)/c1)^2) Coefficients (with 95% confidence bounds): a1 = 0.2424 (-0.4642, 0.949) b1 = -0.7989 (-1.603, 0.005255) c1 = 0.4243 (-0.8226, 1.671)
  1 commentaire
Kendall Cooney
Kendall Cooney le 27 Oct 2021
thanks so much!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Fit Postprocessing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by