Question: Problems 3-5 Practice Problems 3. A vector is given by x= [4.5 5 -16.12 21.8 10.1 10 -16.11 5 14 -3 3 2]. Using conditional
Practice Problems 3. A vector is given by x= [4.5 5 -16.12 21.8 10.1 10 -16.11 5 14 -3 3 2]. Using conditional statements and loops, write a program that rearranges the elements of x in order from the smallest to the largest. Do not use MATLAB's built-in function sort. 4. Write a program that generates a vector with 20 random elements between 10 and 10 and then finds the sum of the positive elements. 5. A twin primes is a pair of prime numbers such that the difference between them is 2 (for example, 17 and 19). Write a computer program that finds all the twin primes between 10 and 500. The program displays the results in a two-column matrix in which each row is a twin prime. Do not use MATLAB's built- in function isprime
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
