a) A = 5:400 gives a vector of integers from 5 to 400
b) Z(i,j) gives (i, j) th entry
c)length(a)=4
size(a)= 4 4
6. Write a function integerdivision that takes two input numbers and divides the first one with the second one. Question 2 a) Create a vector A with all integers between 5 and 400. 4 Marks ) Give...
integers between 5 and 400 Use MATLAB command windows to create a vector with all a) Ans) "deconv" Write a function integerdivision to divide two polynomials function using the command b) d) Write m-file to find the roots of the following linear equation using MATLAB x5 +2x -5x3 +7x2+12x +200 Ans) Questions 2 cover CLO2:/10 a) Write the output of the following MATLAB code >> A = [2,4,10,13:16,3,7,18; 8,4,9,25:3,12,15,171 >> length (A) >> size (A)
Matlab code 4) Write a function leadzero(v) which takes as input a vector v and as output, c, returns the number of zeros at the beginning of v (number of zero elements before any non-zero element). For example, for input (-5, 5, 11] the output would be 0. If the input is [0, 0, 3, 0, 0, 0], the output would be 2. If the input is [0, 0, 0, 0, 7, 4) the output would be 4. 5) Write...
Write a function called ''minandmax'' . Function ''minandmax'' takes only one input argument that is a matrix M . This matrix M can be any size (any number of columns and rows) with any random integer values . Function ''minandmax'' returns two output arguments. The first output argument is called ''difference_row'' that returns a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. The second output argument is called ''difference_all''...
Matlab: Write a function called minimax that takes M, a matrix input argument and returns mmr, a row vector containing the absolute values of the difference between the maximum and minimum valued elements in each row. As a second output argument called mmm, it provides the difference between the maximum and minimum element in the entire matrix. See the code below for an example: >> A = randi(100,3,4) A = 66 94 75 18 4 68 40 71 85 76...
Python Write a function called division that takes as input 2 numbers and divides them without first checking what the inputs contain, returning the value of the division if it succeeds. If one of the inputs is not a number, print 'Cannot divide anything but numbers'. If denominator is 0, print 'Attempted to divide by zero'. If anything else causes the division to not work, print 'An unknown error occurred'. >>> division (6,2) >>> division(3, a) 'Cannot divide anything but...
Use matlab please Write a function mydicegame that takes an input vector d of 5 numbers (representing a roll of 5 dice) and generates the following score s for each roll as an output: -50 points if all the dice are the same value -30 points if they are all consecutive values (e.g. 1 2 3 4 5 or 2 3 4 5 6) -5 points if two of the numbers are the same -10 points if 3 of the...
This code NEEDS TO BE DONE IN MATLAB!!!! Write a function that takes one input, an integer number n, and returns a matrix that is nxn, where the value of each number is the distance from the upper-left to bottom-right diagonal. (Use while loops if you can!) Numbers below the diagonal should be negative, and numbers above the diagonal should be positive. For example, if your input was 5, your output would be: 0 1 2 3 4 -1 0...
The problem demonstrates the use of the random number generator to recover previously generated random numbers Write a function called randi test that takes two scalar positive integer arguments maxi and n, and retums two output arguments: a row vector of n2 elements and and n-by-n matrix. The two output arguments must contain the exact same set of random integers that fall between 1 and maxi Do this using the random number genertor, not by reshaping the data Example n,v-randi...
This problem investigates how you can use random numbers to simulate a computer dice game write a function called twooice that simulates the rolling of two sik-sided dice. The function takes no inputs. Instead, it generates two random integers between 1 and 6, and output their sum. You may submit your work as many times as you want Try to get 100%) Your Function MATLAB Documentation Reset Code to call your function C Reset 1s-tuoDice ss-twoDice This problem investigates how...
C++ Write a function that takes as input parameters (using call by pointer) 3 integers. It generates a random number between 25 and 50 (not including 50). It then creates an array on the memory heap of that length. It generates a random high number (mine was between 5 and 10) and a random low number (between -5 and -10) and fills in the array iteratively with random numbers between the high and the low numbers*, and it returns that...