Curve Fitting with multiple Y data point for each X

5 ビュー (過去 30 日間)
Pat
Pat 2013 年 3 月 28 日
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

採用された回答

Pat
Pat 2013 年 3 月 28 日
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

その他の回答 (1 件)

Matt J
Matt J 2013 年 3 月 28 日
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 件のコメント
Matt J
Matt J 2013 年 3 月 28 日
編集済み: Matt J 2013 年 3 月 28 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by