# Computer science MATLAB

**iat**

1) The primary form of data in MATLAB is vectors. They can be one-dimensional (i.e., vectors), or two-dimensional (i.e., matrices).

a) Write the MATLAB code to create a 1x3 vector containing the elements [1,2,3]. Additionally, write the MATLAB code to create a 3x1 vector with the same elements.

b) Write the MATLAB code to create the vector [2,4,6,...,98,100] and store it in a variable named x(Hint: There is a shorthand notation for regularly spaced vectors).

c) Write the MATLAB code to create a 2x2 matrix containing the elements [1,2,3,4] (The order of the numbers do not matter).

2) MATLAB has several types of built-in math functions that can help you perform common operations.

a) Write the MATLAB code that takes the absolute value of -134.

b) Write the MATLAB code that stores a number 3*pi in a variable named x, then takes the cosine of x.

c) Functions can also be applied to vectors. Assume you have a vector y, which contains the elements [4,9,16]. Write the MATLAB code to take the square root of y. What should the result be?

- 10 years ago
- 7

**Answer(2)**

Purchase the answer to view it

- matlab.docx

Purchase the answer to view it

- vectors.docx

**Bids(1)**

**other Questions(10)**

- Criminal Law-750-1000 words
- College Intro 2 Stats Final .. Questions may be multi-part and not easy. I can only send you 1...
- Accounting hw5
- Accounting HW3
- disadvantages of the use of mobile phones on the road
- Proteach only-Smirky only
- Thinking about your firm and its sector, try to build up such a ‘knowledge map’. What knowledge is currently used in the sector and what knowledge gives competitive advantage
- Thinking about your firm and its sector, try to build up such a ‘knowledge map’. What knowledge is currently used in the sector and what knowledge gives competitive advantage? And how could this change in the future? Try and capture the key points in a si
- MKT 421 Final Exam
- Global Brand Marketing 10