Writing a function in MATLAB

2 ビュー (過去 30 日間)
Kashif Naukhez
Kashif Naukhez 2023 年 10 月 1 日
コメント済み: Kashif Naukhez 2023 年 10 月 1 日
I want to simply write this mathemtical equation in MATLAB, but I am getting some error. Please help.
  13 件のコメント
Kashif Naukhez
Kashif Naukhez 2023 年 10 月 1 日
I need to determine the constants given x and y (in the excel file attached). This is my problem.
Sam Chak
Sam Chak 2023 年 10 月 1 日
The x-data in the 'Double_q.xlsx' spreadsheet is not sorted in ascending order; it appears to resemble an exponential decay when sorted in Excel.

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

採用された回答

dpb
dpb 2023 年 10 月 1 日
% 1. Associate coefficients with parameter array to estimate
A --> b(1)
q1--> b(2)
q2--> b(3)
beta1>b(4)
beta2>b(5)
lambd>b(6)
% 2. Write anonymous function in b(), x
fun=@(b,x) b(1)*(b(2)*b(4)*x).^(1/(1-b(2))) + (1-b(1))*(1-(b(6)/b(5))+(b(6)/b(5))*exp((b(3)-1)*b(5)*x)).^(1/(1-b(3)));
% 3. Pick initial guess for b0 as estimates
b0=[....]; % look at the data and make some reasonable guesses for b(1) thru b(6)
% 4. Solve for b vector...
b=lsqnonlin(fun,b0);
  1 件のコメント
Kashif Naukhez
Kashif Naukhez 2023 年 10 月 1 日
@Sam Chak Thanks!!

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by