Use rand to create a random matrix A of size 5 by 8 Use Matl

Use rand to create a random matrix A of size 5 by 8. Use Matlab to find the following: (a) What is the mean value in each column? (b) What is the mean value in each row? (c) What is the mean for the entire matrix? Enter the following list of numbers into arrays of each of the numeric data types [1, 4, 6; 3, 15, 24]: (a) Double-precision floating point - name this array A (b) Single-precision floating point - name this array B (c) Signed 32-bit integer - name this array C (d) Unsigned 16-bit integer - name this array D

Solution

1)

A=rand(5,8)
disp(\'mean of columns\');
mean(A)
disp(\'mean of rows\');
mean(A,2)
disp(\'mean of the matrix\');
sum(mean(A))/8

>> m1

A =

    0.0855    0.7303    0.9631    0.6241    0.0377    0.2619    0.1068    0.9037
    0.2625    0.4886    0.5468    0.6791    0.8852    0.3354    0.6538    0.8909
    0.8010    0.5785    0.5211    0.3955    0.9133    0.6797    0.4942    0.3342
    0.0292    0.2373    0.2316    0.3674    0.7962    0.1366    0.7791    0.6987
    0.9289    0.4588    0.4889    0.9880    0.0987    0.7212    0.7150    0.1978

mean of columns

ans =

    0.4214    0.4987    0.5503    0.6108    0.5462    0.4269    0.5498    0.6051

mean of rows

ans =

    0.4641
    0.5928
    0.5897
    0.4095
    0.5747

mean of the matrix

ans =

    0.5262

>>

2)

 Use rand to create a random matrix A of size 5 by 8. Use Matlab to find the following: (a) What is the mean value in each column? (b) What is the mean value in

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site