Creating an array with exprnd numbers

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

 Respuesta aceptada

Les Beckham
Les Beckham el 29 de Mzo. de 2020
Editada: Les Beckham el 29 de Mzo. de 2020
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)));

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Productos

Versión

R2019b

Preguntada:

el 29 de Mzo. de 2020

Editada:

el 29 de Mzo. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by