Analysis of using unifrnd function in MATLAB

Source: Internet
Author: User

1. Generate N-order [A, b] evenly distributed array

>> unifrnd (3,5,5,5) ans =    3.8651    4.6677    4.8115    4.3456 4.8560 4.0241    3.4079    3.5713    3.3737    3.5913    3.4801    3.2771    3.2824    3.0893    4.9933    4.4830    4.1280    4.8387    4.3936    4.1785    3.5041    3.5200    3.5431    4.1219    4.2411

2. function function: generate (continuous) uniformly distributed random numbers

How to use: R = Unifrnd (A, b)

Generates a random array r that is continuously uniformly distributed by a and B specified upper and lower endpoints [A, a].
If A and B are arrays, R (I,J) is generated by a and b corresponding elements that specify a continuous uniform distribution of random numbers.
If n or P is a scalar, it is extended to an array with the same number of dimensions as the other input.
R = unifrnd (A,b,m,n,...) or R = Unifrnd (A,b,[m,n,...])
Return m*n* ... Array.
If A and B are scalars, all elements in R are random numbers produced by the same distribution.
If A or B is an array, it must be m*n* ... Array.

Application Examples:

A = 0; b = 1:5; R1 = Unifrnd (A, b) r1 = 0.8147 1.8116 0.3810 3.6535 3.1618B = Repmat (b,5,1); R = Unifrnd (A, b) r = 0.0975 0.3152 0.4257 2.6230 3.7887 0.2785 1.9412 1.2653 0.1428 3.7157 0.5469 1.9143 2.7472 3.3965 1.9 611 0.9575 0.9708 2.3766 3.7360 3.2774 0.9649 1.6006 2.8785 2.7149 0.8559r2 = Unifrnd (A, B (2), 1,5) r2 = 1.4121 0.0637 0.553 8 0.0923 0.1943

3. A number Unifrnd (A, A, b) in rest their lives [a, b]

Analysis of using unifrnd function in MATLAB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.