Creating an array with exprnd numbers

3 次查看(过去 30 天)
Hi guys,
I have one really simple question but struggled a bit, because I am not familiar with Matlab yet.
I want to create a 100x2 array and fill the first column with exprnd numbers and the second column with zeros.
Hope someone can help me out,
best regards,
Alex

采纳的回答

Les Beckham
Les Beckham 2020-3-29
编辑:Les Beckham 2020-3-29
Try this:
A = zeros(100, 2);
mu = 5; % or whatever you want for the mean of the distribution
A(:,1) = exprnd(mu, size(A(:,1)));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by