The following code is correct?

1 回表示 (過去 30 日間)
Ahmed
Ahmed 2024 年 3 月 5 日
コメント済み: Dyuman Joshi 2024 年 3 月 5 日
I have a Ph of size 139 48 101 values ranging say 0 to 0.4, now to compute Kd from Ph have two equations if Ph is equal or less than 0.35 and if Ph is greater than 0.35. I used following code to apply two equation. Have I done it correctly?
Kd = zeros(size(Ph));
% Find indices where Ph is less than or equal to 0.35
indices1 = Ph <= 0.35;
% Find indices where Ph is greater than 0.35
indices2 = Ph > 0.35;
% Apply the first equation to 'kd' where PhiE is less than or equal to 0.35
Kd(indices1) = 38.18.*(1-3.39.*Ph(indices1)+1.95.*Ph(indices1).^2).*1e9;
% Apply the second equation to 'kd' where Ph is greater than 0.35
Kd(indices2) = exp(-62.60.*PhiE(indices2)+22.58).*1e9;
  1 件のコメント
Dyuman Joshi
Dyuman Joshi 2024 年 3 月 5 日
"Have I done it correctly?"
Yes. Your code looks good.

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by