Curve Fitting with multiple Y data point for each X

5 Ansichten (letzte 30 Tage)
Pat
Pat am 28 Mär. 2013
Hi I would like to fit a Gaussian curve to some data. The data are from 3 subjects and there are 7 x data points.
x = [-90 -45 -22.5 - 22.5 45 90] y = [0.3099 0.4806 0.5899 0.6836 0.6635 0.5841 0.2969; 0.2096 0.5600 0.2403 0.7877 0.8406 0.6927 0.2095; 0.1274 0.1973 0.1632 0.5383 0.6522 0.4410 0.1696];
I think I can do the fitting if I average across subjects first but I want to do the fit across all subjects 'at the same time'.
How can I do that??
Thanks for you help,
Pat

Akzeptierte Antwort

Pat
Pat am 28 Mär. 2013
Hi
1- You mean the fitted curve would look the same?
2- But what if I need to run some stats as I have another group of data that I need to compare it with?
I though I'd have more info if I run it at the same time across all the subjects!
Thanks

Weitere Antworten (1)

Matt J
Matt J am 28 Mär. 2013
I think I can do the fitting if I average across subjects first but I want to do the fit across all subjects 'at the same time'
The 2 results would be equivalent.
  1 Kommentar
Matt J
Matt J am 28 Mär. 2013
Bearbeitet: Matt J am 28 Mär. 2013
The fitted curve would be the same. If you fit "all the data" you are minimizing the following cost function with respect to x
sum_{i=[1,2,3]} [norm(F(x,xdata)-y_i)^2]/3
= sum_i [norm(F(x,xdata))^2 + 2*dot(F(x,xdata),y_i)]/3 + constant
= norm(F(x,xdata))^2 + 2*dot(F(x,xdata), sum_i y_i/3) + constant
= norm(F(x,xdata)-sum_i y_i/3)^2 +constant
This shows that minimizing the original curve fitting function is equivalent to minimizing
norm(F(x,xdata)-sum_i y_i/3)^2
which is the same as fitting the average of the data sum_i y_i/3.
I though I'd have more info if I run it at the same time across all the subjects!
You will have more info. The average over y_i will reflect that additional information.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by