Lab2pre-labRevg [Compatibility Mode] -Word Insert Draw Design Layout References
ID: 3588612 • Letter: L
Question
Lab2pre-labRevg [Compatibility Mode] -Word Insert Draw Design Layout References Mailings Review View Tell me what you want to do Home Cut Copy Format Painter File Share Arial AaBbCc AaBbCcDc AaBbCcl AaBbCcl AaBbCc AaBbC AaBbCcl T No Spac. Heading 7 Subtle Em... Emphasis Intense E. Strong ab Replace Paste Clipboard Font Paragraph Styles Editing 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 [24698,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 buit-in math functions that can help you perform common operations. a) Write the MATLAB code that takes the absolute value of -134. Page 1 of 2 235 words English Unite +80% Ask me anything ENG 9:14 AM 2/6/2017 4Explanation / Answer
%1x3 vector
vec13 = (1:3)
%3x1 vector; ' transposes a vector
vec31 = (1:3)'
%linspace(a,b,c) creates a vector of c elements evenly spaced between a,b
x = linspace(2,100,50)
%each till each semicolon will be a row
vec22 = [1 2;3 4]
%use abs(x) to get the absolute value of -134
abs(-134)
%output
%vec13 =
%
% 1 2 3
%
%vec31 =
%
% 1
% 2
% 3
%
%x =
%
% Columns 1 through 13:
%
% 2 4 6 8 10 12 14 16 18 20 22 24 26
%
% Columns 14 through 26:
%
% 28 30 32 34 36 38 40 42 44 46 48 50 52
%
% Columns 27 through 39:
%
% 54 56 58 60 62 64 66 68 70 72 74 76 78
%
% Columns 40 through 50:
%
% 80 82 84 86 88 90 92 94 96 98 100
%
%vec22 =
%
% 1 2
% 3 4
%
%ans = 134
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.