Assessment: 3 of 7 Tests Passed (30%) Are the scalar values defined correctly? Are the vectors defined correctly? Variable math_consts has an incorrect value. Are the matrices defined correctly? The submission must contain variable named mat2. Are the characters defined correctly? Are the strings defined correctly? Are the required values extracted correctly? The submission must contain a variable named r_vec_e7. Are the arrays modified correctly? The submission must contain variable named r_vec. 10% (10%) 0% (10%) 0% (10%) 10% (10%) 10% (10%) 0% (25%) 0% (25%)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

debug the code for me

% 1
gravity_si=9.81
gravity_eng=32.17

 
% 2
math_consts=[0.5772,1.1618,2.718,3.1416]

 
%3
r_vec1=50:-2:1

 
%4
r_vec2=linspace(0,pi,37)

 
%5
science_consts=[6.022*10^23;1.381*10^-23;6.626*10^-34]

 
%6
mat1=[10 4 7 9 11;12 8 2 3 4;7 0 12 6 5]'

 
%7
matw=zeros(6,8)

 
%8
chr1=char("discrete")

 
%9
str1="mathematics"

 
%10
str2=["Generation" "Transmission";"Distribution" "Supply"]
Assessment: 3 of 7 Tests Passed (30%)
✔ Are the scalar values defined correctly?
Are the vectors defined correctly?
Variable math_consts has an incorrect value.
Are the matrices defined correctly?
The submission must contain a variable named mat2.
✔ Are the characters defined correctly?
Are the strings defined correctly?
> Are the required values extracted correctly?
The submission must contain a variable named r_vec_e7.
Are the arrays modified correctly?
The submission must contain a variable named r_vec.
10% (10%)
0% (10%)
0% (10%)
10% (10%)
10% (10%)
0% (25%)
0% (25%)
Total: 30%
Transcribed Image Text:Assessment: 3 of 7 Tests Passed (30%) ✔ Are the scalar values defined correctly? Are the vectors defined correctly? Variable math_consts has an incorrect value. Are the matrices defined correctly? The submission must contain a variable named mat2. ✔ Are the characters defined correctly? Are the strings defined correctly? > Are the required values extracted correctly? The submission must contain a variable named r_vec_e7. Are the arrays modified correctly? The submission must contain a variable named r_vec. 10% (10%) 0% (10%) 0% (10%) 10% (10%) 10% (10%) 0% (25%) 0% (25%) Total: 30%
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 to π with exactly 37 elements. Assign it to the variable r_vec2.
5. Create a column vector containing the elements 6.022x10^23, 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: sclr, 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.
4. Replace the characters 11 to 19 of chr with the words white cat.
5. Replace the first entry of str with the value of sclr.
Transcribed Image Text: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 to π with exactly 37 elements. Assign it to the variable r_vec2. 5. Create a column vector containing the elements 6.022x10^23, 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: sclr, 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. 4. Replace the characters 11 to 19 of chr with the words white cat. 5. Replace the first entry of str with the value of sclr.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Matrix multiplication
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education