Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB HELP 1. How do you create a 1 x n vector consisitng of random integers fo

ID: 638563 • Letter: M

Question

MATLAB HELP

1. How do you create a 1 x n vector consisitng of random integers for example between 0 and 3000

2. How do you then make the 1 x n vector to be a part of a n x 3 array where for example one column will be feet per second, second column will be inches per second, and third column will be yard per second (where the program itself will ask for n, which is feet per second... but the program itself will then convert to inches per second & yard per second)

3. How would you create a for loop and a print statement of this program

,,,,,,,,,,,,

Visually I have an idea on how this will look... This is what I imagine: I input n= 25 (which is feet per second) and then it will automatically give me the answer in inches and yard per second.

Like:

Enter value in ft/second: 25

25 ft/second=300 in/second=8.3333 yd/second

Explanation / Answer

%%% question 1

n=input('enter the length of the array');
random_array=randi([0 3000],1,n);

%%% question 2

n=input('enter value is ft/sec ');
inch=n*12;
yard=0.33333*n;

fprintf(' %f ft/second= %f in/second = %f yd/second',n,inch,yard);