Question

Write a MATLAB code to generate an array of 100 random integers between 1 and 10...

Write a MATLAB code to generate an array of 100 random integers between 1 and 10 using the command “randi”. Using “if” statement, impose the condition that if a number in the array is greater than 5, the number is modified as, number = number – 11. Find the sum of the array and store it. Repeat this exercise for 10, 1000 and 100000 trials and plot the following:

(a) Sums obtained vs trails number

(b) Histogram of the sum giving sum vs count of occurrence of the sum.

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Write a MATLAB code to generate an array of 100 random integers between 1 and 10...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem 6) Use Matlab to perform the followings experiments: a) Use command randi to randomly generate...

    Problem 6) Use Matlab to perform the followings experiments: a) Use command randi to randomly generate 25 integer numbers between 50 and 100 b) Use commands histogram to plot and command histcounts to count the number of numbers generated in part (a) in bins of length 10. That is plot and count the total number of numbers generated between 50 and 60, 60 and 70, and so on. c) Use the combination of commands rand and round to redo part...

  • Code has already been provided to generate two random integers with values between 0 and 10...

    Code has already been provided to generate two random integers with values between 0 and 10 that are assigned to the variables X and Y. Write a script to create the following two string variables: • The first string should be assigned to the variable Xandy and should present the values of the two numbers by filling in the blank in "The value of X is -, and the value of Y is _." The second string should be assigned...

  • in matlab (a)Write a function to generate n random integers between -b and b. (b) Using...

    in matlab (a)Write a function to generate n random integers between -b and b. (b) Using the function you wrote in (a) generate 50 random numbers in a vector A where b = 100; (c) This array A will contain both negative, positive and possibly zero entries. Write a MATLAB script to compute the percentage of positive, negative and zero entries in the array.

  • 1. Write a C code that do the following: Generate array of random integer numbers of...

    1. Write a C code that do the following: Generate array of random integer numbers of size 25 Fill the array with random integers ranging from [1-100] Find the maximum number of the array and its location Find the minimum number of the array and its location Search for a number in the array Print the array Flip the array Sort this array Quit the program when the user choose to exit

  • Using MATLAB, not R codes, I repeat, please, not in R, just MATLAB codes, write the complete code for: 1. Assume Y is an exponential random variable with rate parameter λ=2. (1) Generate 1000 samples...

    Using MATLAB, not R codes, I repeat, please, not in R, just MATLAB codes, write the complete code for: 1. Assume Y is an exponential random variable with rate parameter λ=2. (1) Generate 1000 samples from this exponential distribution using inverse transform method (2) Compare the histogram of your samples with the true density of Y.

  • Q: please solve using matlab code withe comment 1.      Write the Matlab code to generate: x...

    Q: please solve using matlab code withe comment 1.      Write the Matlab code to generate: x = cos(w1*t) + cos(w2*t); where, w1=7; w2=23; t = [0:0.005:2] 2.   Plot the signal using sub plot a.   in time domain b.   in frequency domain 3)   Sample the signal under different sampling conditions: a.      Ts<1/2fm b.      Ts=1/2fm c.       Ts>1/2fm 4).      Multiple plot: the signal sampled under sampling condition and the signal x a.      in time domain b.      in frequency domain c.       Label and Title...

  • please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab:...

    please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab: x[n] = u(n) - u[n-6] a. Mathematically compute yi[n] = x[n] * x[n] where * means convolution. Now use the conv command to perform the convolution. Graph x[n) and the resulting y(n), both over the interval Osns 20. How many non-zero terms does y(n) have? Does your computational result agree with the Matlab result? b. Repeat a. but this time with yz[n] = x[n]*h[n)...

  • Write an application that does the following: (1) fill a 32-bit array with 10 pseudo-random integers...

    Write an application that does the following: (1) fill a 32-bit array with 10 pseudo-random integers between -50 and +49 ; (2) Loop through the array, displaying each value, and count the number of negative values; (3) After the loop finishes, display the count. Below is an assembly program template that you can refer, and complete the programming by filling in the codes into the specified place: Comment ! Title: Counting Array Values Description: Write an application that does the...

  • 1. (30 Points) Write a MATLAB program that displays "The multiplication of 10 multiplied by integers...

    1. (30 Points) Write a MATLAB program that displays "The multiplication of 10 multiplied by integers of 1 through 15. Display your result back to the user with 2 decimal places (yes, 2 decimal places). You must implement your code using a for loop. The result should have the following format: The multiplication of 10*1 =10.00 The multiplication of 10*2 =20.00 The multiplication of 10'3=30.00 The multiplication of 10*15=150.00 2. (35 Points) Write MATLAB code to prompt a user for...

  • We will be using Matlab as the software tool for this lab project. 1.Explore and become...

    We will be using Matlab as the software tool for this lab project. 1.Explore and become familiar with the random number generators in Matlab such as “rand”, “randn”, and “randi” (in fact all software tools can only generate pseudo-random numbers). Notice that to randomize the generators the use of “rng” function is encouraged as the previous techniques are discouraged. 2. “Random walk” is one of the primary and relative simple random processes in which the process starts from a neutral...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT