Hello everyone, recently a reader sent me a private message asking me how to use matlab to draw a lognormal and exponential distribution probability map. The answer is given below.
Lognormal probability plot
Draw with logspace and lognpdf functions.
>> mu = 0;
>> sigma = 1;
>> x = logspace(0,1,100);
>> y = lognpdf(x,mu,sigma);
>> plot(x,y,'LineWidth',2);
Exponential Distribution Probability Plot
This is drawn with exppdf, the test case is as follows
lambda = 0.5; % 指数分布的参数
% 生成一段数据
x = linspace(0, 10, 100); % 在区间 [0,10] 上均匀取样
y = exppdf(x, lambda); % 计算指数分布的概率密度函数值
% 绘制概率图
plot(x, y, 'LineWidth', 2);