Question

Set up a vector n with elements 1, 2, 3, 4, 5. Use MATLAB array opera- tions on it to set up the following four vectors, each with five elements: (a) 2, 4, 6, 8, 10 b)

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

a = 2:2:10
b = (1/2):(1/2):(5/2)
c = 1./(1:5)
d = 1./((1:5).^2)

\;\;

Add a comment
Know the answer?
Add Answer to:
Set up a vector n with elements 1, 2, 3, 4, 5. Use MATLAB array opera-...
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
  • In Matlab Consider the array A. 10 3 5 -4 12 -5 9 2 A= 6...

    In Matlab Consider the array A. 10 3 5 -4 12 -5 9 2 A= 6 13 -8 11 115 -5 4 1 Write a program that computes the array B by computing the square of all the elements of A whose value is greater than 10 and multiplying 5 to each element that is less than or equal to 10. You need to use a logical array as a mask.

  • Solve in MATLAB Problem 3: Given the vector x- [2 1 0 6 2 3 5...

    Solve in MATLAB Problem 3: Given the vector x- [2 1 0 6 2 3 5 3 4 1 3 2 10 12 4 2 7 9 2 4 51 use a for loop to (a) Add up the values of all elements in x (b) Compute the cumulative sum, y, of elements in x You can check your results using the built-in functions sum and cumsum. Q.5 What is the value of the sum of elements in vector x?...

  • MATLAB Create a row vector vC=2:3:38 that has 13 elements. Then, create the following new vectors...

    MATLAB Create a row vector vC=2:3:38 that has 13 elements. Then, create the following new vectors by assigning elements of vC to the new vectors: (a) A vector (name it vCodd) that contains all the elements with odd index of vC; i.e., vCodd = 2 8 14 ... 38. (b) A vector (name it vCeven) that contains all the elements with even index of vC; i.e., vCeven = 5 11 17 ... 35. In both parts use vectors of odd...

  • 4. Create a variable N that is a column vector with seven equally spaced elements in...

    4. Create a variable N that is a column vector with seven equally spaced elements in which the first element is 44 and the last element is 23. 5. Create the following three row vector: a=[5 8-10 2], b=[4 19 -2 3], and c=[-35 06 1]. a) Use the three vectors in Matalb command to creat 3x5 matrix in which the rows are the vectors c, b and a, respectively. b) Use the three vectors in a Matalb command to...

  • Specifications: Lab01a: 1. Has an array of 5 elements that will accept the names of up...

    Specifications: Lab01a: 1. Has an array of 5 elements that will accept the names of up to five animals 2.Has an array of 5 elements that will store a list of up to five animal ages 3.Accepts the name(s) and age(s) of one to five animals. Input should cease at the fifth entry, or when the user enters the word STOP, stop or Stop. (5 points) The animal names can be one or more words. Assume at least one animal...

  • MIPS Assembly Vector (array) addition Create, in the memory, the following two 2-integer arrays (vectors): Array(A),...

    MIPS Assembly Vector (array) addition Create, in the memory, the following two 2-integer arrays (vectors): Array(A), Array(B). *****PLEASE USE MIPS FOR THIS PROGRAM ONLY***** Create, in the memory, the following two 2-integer arrays (vectors): Array (A), Array(B). Array (A) = [2 3], Array (B) = [4 5] (a) Add the two created arrays (vectors): Array (A) + Array (B) = Array(C). (b) Print (console) the elements of the resulting vector [Array(C)].

  • Problem 5 Create the following matrix by typing elements explicitly one command. Do not type individual...

    Problem 5 Create the following matrix by typing elements explicitly one command. Do not type individual 0 00 0 0 o o 0 0 0 0 0 1 2 3 F=0 01 10 20 0 0 2 8 26 0 0 3 6 32 E 0 045 6 0 0 7 8 9 Problem 6 Create two row vectors: a -4 10 0.5 1.8 -2.3 7, b [0.7 9 -53-0.6 12 (a) Use the two vectors in a MATLAB command...

  • In Matlab A= 3 -5 6 ( 15 7 9 13 5 -4 12 10 2...

    In Matlab A= 3 -5 6 ( 15 7 9 13 5 -4 12 10 2 8 11 4 1 For the matrix A in problem-2, use MATLAB to carry out the following instructions a. Find the maximum and minimum values in each column. b. Find the maximum and minimum values in each row. c. Sort each column in ascending order and store the result in an array P. d. Sort each row in descending order and store the result...

  • QUESTION 1 tet M-11 2 3 -1 4 8 121 and N-12 4 3 049 131 Use relational operators to create the fo...

    The code should be in MATLAB. A detailed explanation would help alot. QUESTION 1 tet M-11 2 3 -1 4 8 121 and N-12 4 3 049 131 Use relational operators to create the following vectors: a is the vector consisting of all negative components of M b is the vector consisting of all components of N that are (larger than 3 and smalier than 10) or larger than 11 cis the vector consisting of 3's where the components of...

  • please solve in matlab 1[35p) Write a user-defined MATLAB function that determines the unit vector in...

    please solve in matlab 1[35p) Write a user-defined MATLAB function that determines the unit vector in the direction of the line that connects two points (A and B) in space. For the func- tion name and arguments, use n = unitvec (A,B). The input to the function are two vectors A and B, each with the Cartesian coordinates of the corre- sponding point. The output is a vector with the components of the unit vector Join the direction from A...

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