Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- matlab randn function in mathcad

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-24-2021
06:16 AM

02-24-2021
06:16 AM

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

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-24-2021
11:39 AM

02-24-2021
11:39 AM

@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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-24-2021
07:11 AM

02-24-2021
07:11 AM

Re: matlab randn function in mathcad

rnorm ?:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-24-2021
11:39 AM

02-24-2021
11:39 AM

@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:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-25-2021
01:01 AM

02-25-2021
01:01 AM

Re: matlab randn function in mathcad

Thanks it was helpful