vector of truncated distributions

2 ビュー (過去 30 日間)
george pepper
george pepper 2019 年 8 月 18 日
回答済み: george pepper 2019 年 8 月 18 日
Hello, I would like to create a vector x such that
pd = makedist('Normal');
x(1)=truncate(pd,-inf,y(1));
x(2)=truncate(pd,-inf,y(2));
...
x(K)=truncate(pd,-inf,y(K));
I want to call this vector in CDF evaluations as follows
cdfeval=zeros(N,1)
for n=1:N
for k=1:K
if id(n)==id1(k)
cdfeval(n)=cdf(x(k),pi_point(n,:));
end
end
end
Is there any easy way to do this?

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 8 月 18 日
編集済み: KALYAN ACHARJYA 2019 年 8 月 18 日
Save this function in separate Matlab file named x_vector.m
function x1=x_vector()
pd = makedist('Normal');
x1(1)=truncate(pd,-inf,y(1));
x1(2)=truncate(pd,-inf,y(2));
...
x1(K)=truncate(pd,-inf,y(K));
end
Now call the function in main script:
cdfeval=zeros(N,1)
x=x_vector();
for n=1:N
for k=1:K
if id(n)==id1(k)
cdfeval(n)=cdf(x(k),pi_point(n,:));
end
end
end

その他の回答 (1 件)

george pepper
george pepper 2019 年 8 月 18 日
Thank you!

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by