Objectives 1. To learn how to properly assign, access, and modify numeric, character and string arrays in Matlab. . Instructions Assign 1. Assign the value 9.81 to the variable gravity_si, and the value 32.17 to the variable gravity_eng. 2. Create a row vector containing the elements 0.5772, 1.618, 2.718 and 3.1416. Assign it to the variable math_consts. 3. Create a row vector containing the values from 50 to a value less than or equal to 1 with a decrement of 2. Assign it to the variable r_vec1. 4. Create a row vector containing linearly spaced values from 0 ton with exactly 37 elements. Assign it to the variable r_vec2. 5. Create a column vector containing the elements 6.022x1023, 1.381x10-23 and 6.626x10-34, Assign it to the variable science_consts. 6. Create a matrix containing the elements 10, 4, 7, 9 and 11 on the first column, the elements 12, 8, 2, 3 and 4 on the second column, and the elements 7, 0, 12, 6 and 5 on the third column. Assign it to the variable mat1. 7. Create a 6x8 matrix with all elements equal to zero. Assign it to the variable mat 2. 8. Assign the word discrete as a character type to the variable chr1. 9. Assign the word mathematics as a string type to the variable str1. 10. Create a 2x2 string array containing the following terms: Generation and Transmission on the first row, and Distribution and Supply on the second row. Assign it to the variable str2. Access 1. Load the data from workshop1.mat. It contains the following variables: sc1r, r_vec, c_vec, mat, chr and str.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
1. Objectives
1. To learn how to properly assign, access, and modify numeric, character and string arrays in
Matlab.
II. Instructions
Assign
1. Assign the value 9.81 to the variable gravity_si, and the value 32.17 to the
variable gravity_eng.
2. Create a row vector containing the elements 0.5772, 1.618, 2.718 and 3.1416. Assign it to
the variable math_consts.
3.
Create a row vector containing the values from 50 to a value less than or equal to 1 with a
decrement of 2. Assign it to the variable r_vec1.
4. Create a row vector containing linearly spaced values from 0 ton with exactly 37 elements.
Assign it to the variable r_vec2.
5. Create a column vector containing the elements 6.022x1023, 1.381x10-23 and 6.626x10-34,
Assign it to the variable science_consts.
6.
Create a matrix containing the elements 10, 4, 7, 9 and 11 on the first column, the
elements 12, 8, 2, 3 and 4 on the second column, and the elements 7, 0, 12, 6 and 5 on the
third column. Assign it to the variable mat1.
7.
Create a 6x8 matrix with all elements equal to zero. Assign it to the variable mat2.
8. Assign the word discrete as a character type to the variable chr1.
9. Assign the word mathematics as a string type to the variable str1.
10. Create a 2x2 string array containing the following terms: Generation and Transmission on
the first row, and Distribution and Supply on the second row. Assign it to the variable str2.
Access
1. Load the data from workshop1.mat. It contains the following variables: sc1r, r_vec, c_vec,
mat, chr and str.
2. Extract the seventh element of r_vec. Assign it to the variable r_vec_e7.
3. Extract elements 11 to 18 of c_vec. Assign it to the variable c_vec_1118.
4. Extract elements 72, 96, 144, 240 and 432 of mat. Assign it to the variable mat_212.
5. Extract the entire twelfth row of mat. Assign it to the variable mat_r12.
6. Extract the corner elements of mat. Assign it to the variable mat_cor.
Modify
1. Replace the elements of r_vec with the indices 4, 6, 8, 10 and 15 with 3, 6, 9, 12 and 15,
respectively.
2. Replace the elements of mat with the indices (4, 5), (4, 17), (20, 5) and (20,17) with 5, 8,
2 and 9, respectively.
3.
Replace the all the elements of the eleventh column of mat with ones.
Transcribed Image Text:1. Objectives 1. To learn how to properly assign, access, and modify numeric, character and string arrays in Matlab. II. Instructions Assign 1. Assign the value 9.81 to the variable gravity_si, and the value 32.17 to the variable gravity_eng. 2. Create a row vector containing the elements 0.5772, 1.618, 2.718 and 3.1416. Assign it to the variable math_consts. 3. Create a row vector containing the values from 50 to a value less than or equal to 1 with a decrement of 2. Assign it to the variable r_vec1. 4. Create a row vector containing linearly spaced values from 0 ton with exactly 37 elements. Assign it to the variable r_vec2. 5. Create a column vector containing the elements 6.022x1023, 1.381x10-23 and 6.626x10-34, Assign it to the variable science_consts. 6. Create a matrix containing the elements 10, 4, 7, 9 and 11 on the first column, the elements 12, 8, 2, 3 and 4 on the second column, and the elements 7, 0, 12, 6 and 5 on the third column. Assign it to the variable mat1. 7. Create a 6x8 matrix with all elements equal to zero. Assign it to the variable mat2. 8. Assign the word discrete as a character type to the variable chr1. 9. Assign the word mathematics as a string type to the variable str1. 10. Create a 2x2 string array containing the following terms: Generation and Transmission on the first row, and Distribution and Supply on the second row. Assign it to the variable str2. Access 1. Load the data from workshop1.mat. It contains the following variables: sc1r, r_vec, c_vec, mat, chr and str. 2. Extract the seventh element of r_vec. Assign it to the variable r_vec_e7. 3. Extract elements 11 to 18 of c_vec. Assign it to the variable c_vec_1118. 4. Extract elements 72, 96, 144, 240 and 432 of mat. Assign it to the variable mat_212. 5. Extract the entire twelfth row of mat. Assign it to the variable mat_r12. 6. Extract the corner elements of mat. Assign it to the variable mat_cor. Modify 1. Replace the elements of r_vec with the indices 4, 6, 8, 10 and 15 with 3, 6, 9, 12 and 15, respectively. 2. Replace the elements of mat with the indices (4, 5), (4, 17), (20, 5) and (20,17) with 5, 8, 2 and 9, respectively. 3. Replace the all the elements of the eleventh column of mat with ones.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY