現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
0 投票
Hi,
I have a number of curves that have the same trend and relatively close to one another on the same plot and wish to fit these curves so that they can be represented by a single curve. Please advise me on how to do it.
Thanks
Isa
採用された回答
Walter Roberson
2012 年 12 月 27 日
You could fit the mean (or the median) of the curves. But if you wish to give more importance to larger deviations from the mean, then you would use different techniques.
What kind of curve are you planning to fit?
7 件のコメント
Isa Isa
2012 年 12 月 27 日
Thanks. I am trying to fit 6 power law curves. Can you explain further on fitting the mean or median of the curves and other different techniques you earlier mentioned.
Regards,
Isa
Walter Roberson
2012 年 12 月 27 日
Are the curves all sampled at the same timepoints (or same x) ? If so, then put all of the data in a single matrix and take the median() across the appropriate dimension, and fit the result.
When you say 6 power law curves, do you mean the sum of 6 such curves, or do you mean you have 6 curves that you would like to fit to a single power-law curve? If you have 6 curves that you are trying to fit to a single power-law curve, then you can use the \ operator together with
[ repmat(x(:),6,1), ones(length(x)*6,1) ]
and
log([y1;y2;y3;y4;y5;y6])
... but I can never remember which argument goes on which side of the \ operator. The idea here is that log(y) should be a linear fit for x. Remember to take exp() of the second coefficient output; the first coefficient output will be the exponent for the power law (and should be negative.)
Isa Isa
2012 年 12 月 27 日
Thanks. I have 6 curves that I would like to fit to a single power-law curve.
Regards, Isa
Walter Roberson
2012 年 12 月 27 日
If you have the Optimization Toolbox then you can work more accurately using one of the nonlinear least-squares routines; see http://www.mathworks.com/help/optim/nonlinear-least-squares-curve-fitting.html
Isa Isa
2012 年 12 月 27 日
編集済み: Walter Roberson
2012 年 12 月 27 日
I have idea about using lsqcurvefit to fit dependent and independent variables. But my present case is such that I have a number of power law curves with x(i) and y(i) (i is the number of curves). For instance, I have these three curves
x1=[0.8380 0.5400 0.3600 0.2680 0.2250 0.1930 0.1710];
y1=[0.0582 0.2328 0.5820 1.7459 3.4918 5.8197 11.6394];
x2=[0.8960 0.6040 0.4460 0.3720 0.3310 0.3030 0.2600];
y2=[0.0218 0.0870 0.2176 0.6528 1.3056 2.1759 4.3518];
x3=[0.6110 0.3740 0.2570 0.1830 0.1510 0.1290 0.1110];
y3=[0.0832 0.3328 0.8320 2.4959 4.9918 8.3196 16.6392];
I am trying to fit to a single power-law curve. I have optimization toolbox.
Thanks
Isa
Walter Roberson
2012 年 12 月 27 日
allX = [x1,x2,x3,x4,x5,x6];
allY = [y1,y2,y3,y4,y5,y6];
A = [log(allX(:)), ones(length(allX),1)];
B = log(allY(:));
C = A \ B;
sortX = sort(allX);
plot(sortX, exp(C(2)) * sortX .^ C(1))
Isa Isa
2012 年 12 月 27 日
Thanks. It works
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Interpolation についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
