Need this to be used in MATLAB from Python

1 回表示 (過去 30 日間)
Felicia Muniz
Felicia Muniz 2020 年 11 月 4 日
コメント済み: drummer 2020 年 11 月 5 日
def marshall_dist(Dvec,RR):
"""
Calcuate the Marshall Palmer drop size distribution
Input: Dvec: vector of diameters in mm
RR: rain rate in mm/hr
output: n(Dvec), length of Dvec, in m^{-3} mm^{-1}
"""
N0=8000 #m^{-3} mm^{-1}
the_lambda= 4.1*RR**(-0.21)
output=N0*np.exp(-the_lambda*Dvec)
return output

回答 (1 件)

drummer
drummer 2020 年 11 月 4 日
% to call your function in MATLAB
yourResult = marshall_dist(input1, input2) % whatever are your input argument values.
% functions go in the end of the script in MATLAB
function output = marshall_dist(Dvec, RR)
N0 = 8000;
lambda = 4.1*RR^(-0.21);
output = N0*exp(-lambda*Dvec);
end
Cheers
  1 件のコメント
drummer
drummer 2020 年 11 月 5 日
did it work?

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

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by