How to fit a dataset with two independant variables (of different dimensions) and one dependant variable?

1 回表示 (過去 30 日間)
I need to fit data points of an Intensity-Duration-Frequency curve into a non-linear equation of the form
i=K*(T^a)/((t+b)^n)
where i is the intensity(dependant),T the return period(independant) and t the duration(independant).
K,a,b,n are the coefficients to be found.
t={ 1 2 4 5 10 12 15 24 36 48 }
T={2 5 10 25 50 100}
I was attempting nlinfit with the two independant variable data sets to be in one single matrix,but dimensions do not agree for the two.How would i fit these?
  2 件のコメント
Matt J
Matt J 2021 年 3 月 15 日
What are the dimensions of i?
Ashok Jacob
Ashok Jacob 2021 年 3 月 16 日
there are 10*6= 60 data points in i,one for each combination of t and T.
Apologies for the oversight.

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

回答 (1 件)

Jeff Miller
Jeff Miller 2021 年 3 月 16 日
You need give nlinfit the corresponding 60 values of t and T. Something like this (but check the order of the resulting 60 points):
t=[ 1 2 4 5 10 12 15 24 36 48];
T=[2 5 10 25 50 100];
[t2, T2] = ndgrid(t,T);
t2 = reshape(t2,60,1);
T2 = reshape(T2,60,1);
% now pass t2 and T2 to nlinfit

カテゴリ

Help Center および File ExchangeOptimization Toolbox についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by