cancel
Showing results for
Search instead for
Did you mean:
cancel
Showing results for
Search instead for
Did you mean:

## matlab randn function in mathcad

SOLVED  Participant

## matlab randn function in mathcad

How to generate random values in Mathcad exactly like randn function generates in matlab?

1 ACCEPTED SOLUTION

Accepted Solutions  Ruby III
(in response to SK_9833315)

## Re: matlab randn function in mathcad

@SK_9833315 wrote:

How to generate random values in Mathcad exactly like randn function generates in matlab?

That depends on how you would define "exactly" 🙂

If your goal is to create a couple of normal distributed random numbers, rnorm(n,0,1) may be all you need, as shown by Francesco.
In Matlab the output of randn is either a single scalar or a multidimensional matrix (n x 1 vector being only a special case of it). Mathcad on the other hand will only create a  n x 1 vector. So this is a limitation, but on the other hand its easier in Mathcad to use different  values for mean and standard deviation.

To create single scalars and matrices  in Mathcad you will have to use some additional bits of code.

Here are some examples: If you use these more often, it may be convenient to create some functions to do the job: 3 REPLIES 3  Topaz I
(in response to SK_9833315)

## Re: matlab randn function in mathcad

rnorm ?:    Ruby III
(in response to SK_9833315)

## Re: matlab randn function in mathcad

@SK_9833315 wrote:

How to generate random values in Mathcad exactly like randn function generates in matlab?

That depends on how you would define "exactly" 🙂

If your goal is to create a couple of normal distributed random numbers, rnorm(n,0,1) may be all you need, as shown by Francesco.
In Matlab the output of randn is either a single scalar or a multidimensional matrix (n x 1 vector being only a special case of it). Mathcad on the other hand will only create a  n x 1 vector. So this is a limitation, but on the other hand its easier in Mathcad to use different  values for mean and standard deviation.

To create single scalars and matrices  in Mathcad you will have to use some additional bits of code.

Here are some examples: If you use these more often, it may be convenient to create some functions to do the job:   Participant
(in response to Werner_E)

## Re: matlab randn function in mathcad

Thanks it was helpful

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."