Problem with undefined function

2 ビュー (過去 30 日間)
Ourania
Ourania 2023 年 1 月 29 日
編集済み: Torsten 2023 年 1 月 29 日
Here , it a part of my code.
PGA=[1.0000000e-01,2.0000000e-01,4.0000000e-01,9.00000e-01,1.00000e+00,1.4000000e+00,0.500000e+00,1.700000e+00,2.00000e+00,2.5000000e+00,2.800000e+00,3.5000000e+00].';
Z1=log(PGA/th1)/b1;
for i=0:1:11
if Z1(i+1)<0
Z1(i+1)=Z1(i+1)+1;
P1=logncdf(Z1(i+1));
else
P1=logncdf(Z1(i+1));
end
P1(i+1)=P1;
end
disp(P1);
Error message:
Undefined function 'logncdf' for input arguments of type 'double'.
Error in excersise_1 (line 25)
P1=logncdf(Z1(i+1));

回答 (2 件)

Paul
Paul 2023 年 1 月 29 日
logncdf is a function in the Statistics and Machine Learning Toolbox. That toolbox needs to be installed and it will have to be included on your license.

Torsten
Torsten 2023 年 1 月 29 日
編集済み: Torsten 2023 年 1 月 29 日
An alternative without the toolbox:
logncdf_user = @(x,mu,sigma) 0.5*(erf((log(x)-mu)/(sqrt(2)*sigma))+1);
x=0:0.1:10;
hold on
plot(x,logncdf_user(x,0,1))
plot(x,logncdf(x,0,1))
hold off
grid on

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by