Convolution of two log normal distributions

12 ビュー (過去 30 日間)
Joshua Woodard
Joshua Woodard 2019 年 9 月 17 日
編集済み: Bruno Luong 2019 年 9 月 18 日
Greetings. I am trying to do the convolutions of two lognormal distributions however, I am getting errors. I started to question my method but I cannot find a mistake in my script. Is there a better way? I seem to be getting unexpected numerical values. I would expect like any CDF to approach 1, but this one is not.
%% Convolution of two LogNormal Distributions.
clc
clear all
format long
muX = 9.7224; % For Ni Distribution (X-domain)
sigmaX = 0.3332; % For Ni Distribution (X-domain)
muY = 8.6878; % For Np Distribution (Y-domain)
sigmaY = 0.2454; % For Np Distribution (Y-domain)
t = inf; % Cycles input (would expect an answer of 1 with t = inf.)
fun = @(y,x) exp(-0.5.*((log(x) - muX).^2)./(sigmaX.^2))./(x.*sigmaX.*sqrt(2.*pi)) .* exp(-0.5.*((log(y) - muY).^2)./(sigmaY.^2))./(y.*sigmaY.*sqrt(2.*pi));
P = integral2(fun,-inf,t - 'x',-inf,inf,'RelTol',1e-12,'AbsTol',1e-12)

採用された回答

Jeff Miller
Jeff Miller 2019 年 9 月 18 日
Convolutions are pretty easy to do in Cupid. For example, the following code gives the attached figure
muX = 9.7224; % For Ni Distribution (X-domain)
sigmaX = 0.3332; % For Ni Distribution (X-domain)
muY = 8.6878; % For Np Distribution (Y-domain)
sigmaY = 0.2454; % For Np Distribution (Y-domain)
conv = Convolution(Lognormal(muX,sigmaX),Lognormal(muY,sigmaY));
conv.PlotDens
This might be handy if you also want to try other distributions, try fitting data, etc.

その他の回答 (2 件)

Bruno Luong
Bruno Luong 2019 年 9 月 18 日
編集済み: Bruno Luong 2019 年 9 月 18 日
LOGNORMAL is defined on (0,Inf) not (-Inf,Inf)
P = integral2(fun,0,t - 'x',0,inf,'RelTol',1e-12,'AbsTol',1e-12)
returns correctly
P =
1.0000

Image Analyst
Image Analyst 2019 年 9 月 18 日
For convolution, use conv() on your numerical vectors.

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by