Question

octave program . write a for loops to generate a 3x4 matrix with random values in...

octave program . write a for loops to generate a 3x4 matrix with random values in the interval [4, 20].

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

clc
clear all
close all
M=[];
for i=1:3
for j=1:4
M(i,j)=randi([3,20],1,1);
end
end
disp('Matrix is');
disp(M);

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
octave program . write a for loops to generate a 3x4 matrix with random values in...
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
  • Write a program in C to generate random numbers. The program recieves 4 items on activation...

    Write a program in C to generate random numbers. The program recieves 4 items on activation through argv: 1. Name of the data file 2. Number of items for program to generate 3. Range of numbers 4. Seed of the random number generator Example run: ./rand datafile.txt 20 1000 3127 Program must convert all numbers to ints using atoi(), must save all parameters into variables, opens the data file to write the random numbers into it, program loops to generate...

  • Write a C++ program to define a class having a 4x4 matrix. Generate 32 random numbers...

    Write a C++ program to define a class having a 4x4 matrix. Generate 32 random numbers 1-10, in an output.txt file. Fill the generated numbers in two such class objects (first 16 numbers in one matrix and next 16 numbers in another. Create member functions each for adding, subtracting and multiplication of matrices. Write the algorithm defining steps of your program.

  • Please code in MatLab or Octave Output should match Sample Output in the second picture Thank...

    Please code in MatLab or Octave Output should match Sample Output in the second picture Thank You 4. In this problem we will investigate using loops to calculate the product of two matrices. Given an mxn matrix A and an n x p matrix B, the matrix product C = AB is the m xp matrix with Cij = R=1 Qikbky. Write a program which calls a function get matrix.dimensions which should • print a description of the purpose of...

  • [Using Python] Create a program that uses import random and while loops to generate one random...

    [Using Python] Create a program that uses import random and while loops to generate one random question, from a list of 5, for each repeated run. Report the number of the correct answers after all five questions have been answered. Your 5 questions should be a simple math problem, like "what is 7-5?"

  • 3. Random matrices are matrix generalization of random variables. To examine the distribution of eigenvalues of...

    3. Random matrices are matrix generalization of random variables. To examine the distribution of eigenvalues of such matrices, first generate a 100x100 random matrix with elements selected from a random distribution of ones and zeros (to do this you can start with the function rand( ) together with round( ) or alternatively randi( )) and then find the absolute value (the norm) of each the eigenvalues of this matrix with the routine eig。 Repeat this 100 times storing all the...

  • Create a program using the Random class and While loops in Java. The program should generate...

    Create a program using the Random class and While loops in Java. The program should generate a random number from 50 through 100. The loop should add the five random numbers generated. On each iteration of the loop the program should print out the number generated, how many numbers have been generated thus far, and the sum so far. On the last iteration, the printout should say the The final total is.... Teach comment the last time I did it:...

  • programming language Write a program that will generate 5 random numbers between 20 and 80 and...

    programming language Write a program that will generate 5 random numbers between 20 and 80 and assign each to a variable of datatype double. You should use a random number generator seeded with time Using a series of if statements, determine which of the 5 variables contains the smallest value generated Print all five random numbers to the screen and print out the value that you determined was the smallest. All values should be printed with zero decimal places. 2.

  • Using Perl Program: Write a program that will generate a DNA sequence (at random) of size...

    Using Perl Program: Write a program that will generate a DNA sequence (at random) of size 1000 bp. The sequence should contain all four nucleotides (A, G, C and T).

  • write program above in C only Write a program to find statistics on some random numbers....

    write program above in C only Write a program to find statistics on some random numbers. Seed the random number generator with time. In a for loop generate 12 random numbers between the values of 2 and 20. Print the numbers. As the numbers are generated, find the following: the number of even numbers (those evenly divisible by 2) e the sum of the even numbers the product of the even numbers the maximum value of all the numbers e

  • Solve Question using While loops-MATLAB Write a program that generates a random number and asks the...

    Solve Question using While loops-MATLAB Write a program that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." The program should use a loop that repeats until the user correctly guesses the random number.

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