Вы находитесь на странице: 1из 21

Group: 04

Member: 1. Mikko Loren Pangestu (03411740000002)


2. Adika Bagaskara (03411740000020)
3. Isti Faizati (03411740000040)

INTRODUCTION TO MATLAB

A. Concept

1. The following commands and functions, except…


A. clc for Clear Command Window
B. pwd for Display current directory
C. clear for Terminate MATLAB (same as quit)
D. cd for Change working directory
E. computer for Display Workspace browser

Answer: C and E
Solution: Clear for remove items for workspace and then computer for indentify
version about computer on which MATLAB is running

2. The MATLAB toolbar provides on-screen buttons to access frequently used


features such as…
A. Copy
B. Paste
C. Undo
D. Redo
E. Save

Answer: All answers correct

3. MATLAB provides keyboard shortcuts for viewing a history of command and


listing contextual help…
A. The up arrow key
B. The shift key
C. The tab key
D. Forward slash symbol
E. The semicolon symbol

Answer: A, C and D
Solution: answer B and E cannot for viewing a history of commands
4. MATLAB comes with three forms of online help except…
A. Help
B. Doc
C. Txt
D. Demos
E. Web browser

Answer: C and E
Solution: Answer C and E are not a form of help in Matlab

5. The menu bar contains commands for…


A. Creating
B. Opening
C. Printing
D. Editing
E. Manipulating desktop item

Answer: All answers correct


Solution: We can find all command at answer in menu bar

6. What a stands for MATLAB ?


A. Mathematics
B. Mathematics Laboratory
C. Matlabuation
D. Metal Laboratory
E. Matrix Laboratory

Answer : E
Solution : MATLAB stands for MATrix LABoratory

7. MatLab is a commercial software application written by


A. Mathematic,Inc
B. MathWorks,Inc
C. WorksMath,Inc
D. Mathematics.com
E. All Wrong
Answer : B
Solution : MATLAB is a commercial software application written by The
MathWorks, Inc. (www.mathworks.com)
8. . The standard MATLAB installation features features for scientific and
scientific data in….plots
A. 2-D
B. 3-D
C. Excel, Word
D. Exploring
E. All Wrong

Answer : A and B
Solution : The standard MATLAB installation features features for scientific
and scientific data in 2-D and 3-D plots.

9. MATLAB also contains interactive tools to…… and…….


A. Exploring
B. Graphic mode
C. All wrong
D. Cleaner
E. Analyze data

Answer : A and E
Solution : MATLAB also contains interactive tools to explore and analyze data.

10. MATLAB interacts with other applications (e.g. Microsoft Excel) and can be
called from
A. D code
B. E code
C. A code
D. B code
E. C code

Answer : E
Solution : MATLAB interacts with other applications (e.g. Microsoft Excel)
and can be called from C code, C +++ or Fortran programming language

11. Where we can run MATLAB under Mac OS X or Microsoft Windows operating
systems through a
A. PC
B. Computer
C. Handphone
D. Web Browser
E. Facebook

Answer : D
Solution : We can run MATLAB under Mac OS X or Microsoft Windows
operating systems through a web browser

12. When you start the MATLAB program, it displays the MATLAB desktop, What
is the desktop
A. For managing files
B. For variables, and applications associated with MATLAB
C. For calculate Erroring
D. For education
E. All wrong

Answer : A and B
Solution : The desktop is a set of tools (graphical user interfaces or GUIs) for
managing files, variables, and applications associatedwith MATLAB.

13. What is the meaning of the commad History in Matlab


A. Application and system
B. Programming language
C. Log of the commands we have executed in the command window
D. Default layout
E. A and B is Wrong

Answer : C
Solution : The Command History is a log of the commands we have executed in
the command window

14. What the meaning about Workspace in Matlab


A. Consists of a set of variables stored in memory during a MATLAB session.
B. Log of the commands we have executed in the command window
C. Application and system
D. Variables, and applications associated with MATLAB
E. All wrong

Answer : A
Solution : Workspace consists of a set of variables stored in memory during a
MATLAB session.

15. How to open the Workspace browser


A. Select Desktop > Workspace in the MATLAB desktop,or type >>
workspace at the Command Window prompt
B. select Workspace > variables in the MATLAB desktop,or type >>
workspace at the Command Window prompt
C. The up arrow key, The tab key, The semicolon symbol.
D. A and B wrong
E. Begin typing “y=sq” in thecommandprompt: >>y=sq

Answer : A
Solution : To open the Workspace browser, select Desktop > Workspace in the
MATLAB desktop,or type >> workspace at theCommandWindow prompt

B. Calculation / Computation

1. Calculate the following trigonometric quantities…


𝑦 = cos 0
A. 1
B. 0
C. 0,5
D. 0,8
E. 0,6

Answer: A
Solution:
>> y = cos (0)
y=1

2. Calculate √81 + √64 using Matlab…


A. 7
B. 18
C. 36
D. 9
E. 17

Answer: E
Solution:
>> y=sqrt (81) + sqrt (64)
y = 17

3. Calculate the following quantities :


4 + 52 . 2−1
2. 90.5
A. 1.7083
B. 0.6667
C. 5.8750
D. 2.3489
E. 4.5917

Answer: C
Solution:
>> (4 + (5^3*2^-2))/(2*9^0.5)
ans = 5.8750

4. Find the answer for the following


x3 – 7x2 + 40x – 34 = ….
A. x = 1
B. x = 3 ± 5i
C. x = 9i + 7
D. x = 7i + 9
E. All wrong

Answer : A and B
Solution :
To find the roots, first we enter the coefficients of polynomial in to a row vector
p with p=[1, -7, 40, -34] and issue the r=roots(p) command. The following
shows the command
window output:
>> a = [ 1, -7, 40, -34 ]

a=

1 -7 40 -34

>> roots (a)

ans =

3.0000 + 5.0000i
3.0000 - 5.0000i
1.0 .0000i

5. Use MATLAB to compute the following expressions


6(351/4) + 140.35 =…
A. 55.0185
B. 65.9800
C. 17.1123
D. Error: Unbalanced or unexpected parenthesis or bracket.
E. 55.0165

Answer : C
Solution :
>> 6*(35^0.25) +14^0.35
ans =
17.1123

6. Use MATLAB to compute the following expressions


10 18
6( ) + + 5(92 ) =
13 5(7)
A. 415.0097
B. 410.1297
C. 449.1297
D. 210.1297
E. 400.1297

Answer : B
Solution :
>> a = 6*(10/13)
a=
4.6154
>> b = 18/35
b=
0.5143
>> c = 5*(9^2)
c=
405
>> a+b+c
ans =
410.1297
Short Solution :
>> 6*(10/13)+ (18/35) + (5*(9^2))
ans =
410.1297

7. Let us calculate the devide of polynomial x5-2x4+5x3+7x2-14x+35 : x2-2x+5


: 98x2 + 13x
A. x3+7
B. x3 + 7x + 9
C. x4 + 9
D. x2 + 74
E. 3x3 + 7x + 9

Answer : A
Solution :
>> r = [1 -2 5 7 -14 35]
r=
1 -2 5 7 -14 35
>> q = [1 -2 5]

q=
1 -2 5
>> p = deconv(r,q)
p=
1 0 0 7

8. Let us calculate the cross of polynomial p(x) = x3+7 and q(x) = x2-2x+5
A. x5-2x4+5x3+7x2-14x+35
B. x3-9x2+5x+30
C. 90x7 - x5-2x4+5x3+7x2-14x+35
D. x5-9x4+9x3+6x2-14x+35
E. 5x3+7x2-14x+35

Answer : A
Solution :
>> p = [1 0 0 7];
q = [1 -2 5];
r = conv(p,q)
r=
1 -2 5 7 -14 35

9. Calculate : tan 87 + cos 34 + log10 34 – cos-1 35 =


A. -0.7595 - 4.2483 i
B. 7.7595 - 4.2483 i
C. 595 - 4.23 i
D. -9.7595 - 4.2483i
E. All wrong
Answer : A
Solution :
>> tan (87)+ cos (34) + log10(34) - acos (35)
ans =
-0.7595 - 4.2483 i

10. You can use the left division operator in MATLAB to solve sets of linear
algebraic equations.
6 x + 12y + 4z = 70
7 x - 2y + 3z = 5
2 x + 8y - 9z = 64
A. x = 3
B. y = 5
C. z = -2
D. x = 4
E. y = 6

Answer : A, B, and C
Solution :
>> A = [6,12,4;7,-2,3;2,8,-9]

A=

6 12 4
7 -2 3
2 8 -9

>> B = [70;5;64]

B=

70
5
64

>> Solution = A\B

Solution =

3
5
-2

GETTING STARTED TO MATLAB


A. Concept

1. The following basic operating commands and their meanings, except…


A. Sum (sum of array elements)
B. Sqrt (square root)
C. Log10 (natural logarithm)
D. Mean (average or mean value of array)
E. Sdt (standard deviation)

Answer: C
Solution: log10 for common logarithm (base 10) and log for natural logarithm

2. The following mathematical operators and correct description is…


A. + (addition)
B. – (subtraction)
C. * (multiplication)
D. ^ (power)
E. / (left matrix division)

Answer: A, B, C, and D
Solution: Answer E is not correct because the correct mathematical operators
for left matrix division is \

3. Type the following at command prompt of row vector…


A. b = [2 4 6 8 10]’
B. b = [2 4 6 8 10]
C. b = [2;4;6;8;10]
D. b = [2;4;6;8;10]’
E. b = [2:4:6:8:10]

Answer: B
Solution: Elements of a row vector are separated with blank or commas

4. Type the following at command prompt of transpose a row vector…


A. c = [1 3 5 7 9]’
B. c = [1 3 5 7 9]
C. c = [1;3;5;7;9]
D. c = [1;3;5;7;9]’
E. c = [1:3:5:7:9]

Answer: A
Solution: Transposing a row vector with ‘ operator

5. Type the following at command prompt of column vector…


A. c = [1 2 3 4 5]’
B. c = [1 2 3 4 5]
C. c = [1;2;3;4;5]
D. c = [1;2;3;4;5]’
E. c = [1:2:3:4:5]

Answer: C
Solution: Elements of a column vector is ended by a semicolon

6. What does mathematical operator “.*” (Dot Asterisk) in MATLAB used for ?
A. Division
B. Array Multiplication
C. Power
D. Right Array Divide
E. Left Array Divide

Answer : B
Solution : Mathematical operator “.*” (Dot Asterisk) in MATLAB used for
Array Multiplication (element-wise).

7. How to get radians for trigonometrics function in MATLAB?


A. Multiply degrees by 90
B. Divide degrees by 180
C. Multiply degrees by pi/90
D. Multiply degrees by pi/180
E. None of the answers above are correct

Answer : D
Solution : To get radians for trigonometrics function in MATLAB we have to
multiply degrees by pi/180. For example, to calculate cos(60), type
cos(60*pi/180).
8. In MATLAB, the numerical results in short are format displayed with .... digits
after the decimal point, while the long format produces .... digits after the
decimal point
A. 4 and 15
B. 3 and 15
C. 4 and 12
D. 3 and 12
E. 4 and 16

Answer : A
Solution : The numerical results in short format are displayed with 4 digits after
the decimal point, while the long format produces 15 digits after the decimal
point.

9. A named value in MATLAB is called ....


A. Parameters
B. Variable
C. Data
D. Quantity
E. Quality

Answer : B
Solution : In MATLAB a named value is called variable.

10. Scalars and vectors in MATLAB are special cases of matrices, row vector is
having size ....
A. 1x1
B. 1xn
C. nx1
D. nxn
E. None of the answers above are correct

Answer : B
Solution : The size of row vector is 1xn.

11. Which one of the examples below is correct to type a 2x4 matrix ?
A. [3 6 9 12 2 4 6 8]
B. [3 6 9 12: 2 4 6 8]
C. [3 6 9 12* 2 4 6 8]
D. [3 6 9 12, 2 4 6 8]
E. [3 6 9 12; 2 4 6 8]

Answer : E
Solution : Matrices are typed in rows first and separated by semicolons to create
columns.

12. Functions that are built by simply adding together (or subtracting) some powers
function is called ....
A. Polynomials
B. Exponential
C. Trigonometry
D. Logarithmic
E. Sinusoidal

Answer : A
Solution : Functions that are built by simply adding together (or subtracting)
some powers function is called polynomials.

13. To split a long statement over multiple lines, at the end of the line we have to
enter ....
A. Three Back Slash “\\\”
B. Three Forward Slash “///”
C. Semicolons “;”
D. Three periods “...”
E. None of the answers above are correct

Answer : D
Solution : To split a long statement over multiple lines we have to enter three
periods “...” at the end of the line.

14. To separates the comments from the code, which symbols from the option below
we have to input?
A. :
B. ;
C. %
D. [ ]
E. ( )

Answer : C
Solution : The percent symbol “%” separates the comments from the code

15. Which one from the character below used for prioritize operations in MATLAB?
A. [ ]
B. ( )
C. < >
D. { }
E. None of the anwers above are correct

Answer : B
Solution : To prioritize operations in MATLAB, we have to input the “( )”
character

B. Calculation / Computation

1. Calculate the following logarithmic quantities…

1 1
. log 25 + . 𝑙𝑜𝑔10
6 3
A. -0.1003
B. -0,6725
C. 1,6801
D. 5.8900
E. -3.2837

Answer: A
Solution:
>> (1/6* log10(25))-(1/3*log10(10))
ans = -0.1003

2. Calculate the following trigonometric quantities :


𝜋
tan ( ) + 𝑠𝑖𝑛 (165) =
3
A. 9.1824
B. 1.9288
C. 3.2661
D. 1.9909
E. 2

Answer: D
Solution:
>> tan (pi/3)+ sin(165*pi/180)
ans = 1.9909

3. Consider the following equation 𝑥 2 + 2𝑥 − 3 find the roots…


A. 1 or 3
B. -1 or 3
C. 1 or -3
D. -1 or -3
E. -2 or 5

Answer: C
Solution:
p = 1 2 -3
>> r= roots(p)
r = -3.0000
1.0000

4. Calculate A-B following 2 matrix…


6 7 1 2
𝐴=( ) 𝐵=( )
8 9 3 4
5 9
A. ( )
5 13
7 5
B. ( )
11 5
5 5
C. ( )
5 5
5 6
D. ( )
8 13
7 5
E. ( )
5 4

Answer: C
Solution:
>> A = [6 7;8 9]

A=

6 7
8 9

>> B = [1 2;3 4]

B=

1 2
3 4

>> C=A-B
C=

5 5
5 5

5. Find the value for polynomial g(x) = x6 – 5x5 + 2x3 + 3x2 - 2 for x = -2 using
MATLAB!
A. 212
B. -214
C. -216
D. 214
E. 216

Answer : E
Solution :
>> p=[1 -5 0 2 3 0 -4]

p=

Columns 1 through 6

1 -5 0 2 3 0

Column 7

-4

>> polyval (p,-2)

ans =

216

6. Given f(x) = 3x3 – 5x and g(x) = x4 + 3x2 – 2. Find the value of f(2).g(2)
using MATLAB!
A. 286
B. 244
C. 364
D. 386
E. 424
Answer : C
Solution :
>> f=[3 0 -5 0]

f=

3 0 -5 0

>> a=polyval(f,2)

a=

14

>> g=[1 0 3 0 -2]

g=

1 0 3 0 -2

>> b=polyval (g,2)

b=

26

>> a*b

ans =

364

7. Find the value of the following equation using MATLAB!


2
144 82 + 12
7 ( )+ =⋯
11 93
A. 641.5588
B. 662.5588
C. 773.4477
D. 789.4477
E. 777.4487

Answer : A
Solution :
>> a=7^2*(144/11)

a=

641.4545

>> b=(8^2+12)/9^3

b=

0.1043

>> a+b

ans =

641.5588

8. Given f(x) = 2x4 - 3x2 + 5x + 8 and g(x) = 7x3 – 4x2 + 7x. Find the value of
f(-3):g(3) using MATLAB!
A. 0.7458
B. 0.7356
C. 0.8764
D. 0.8865
E. 0.8876

Answer : B
Solution :
>> f=[2 0 -3 5 8]

f=

2 0 -3 5 8

>> a=polyval (f,-3)


a=

128

>> g=[7 -4 7 0]

g=

7 -4 7 0

>> b=polyval (g,3)

b=

174

>> a/b

ans =

0.7356

9. Given p(x) 0,8x3 + 0,4x2 + 2x + 1. Find the value of cos(p(2)) using


MATLAB!
A. 0.9074
B. 0.8074
C. 0.7074
D. 0.6078
E. 0.5078

Answer : A
Solution :
>> p=[0.8 0.4 2 1]

p=

Columns 1 through 3

0.8000 0.4000 2.0000


Column 4

1.0000

>> a=polyval (p,2)

a=

13

>> cos(a)

ans =

0.9074

π
10. Calculate the value of θ = sin( 6𝑥 3 +2𝑥 2 − 7 ) if x = 3 using MATLAB !
A. 0.0294
B. 0.0282
C. 0.0182
D. 0.0194
E. 0.0178

Answer : C
Solution :
>> p=[6 2 0 -7]

p=

6 2 0 -7

>> a=polyval (p,3)

a=

173

>> theta=sin(pi/a)
theta =

0.0182

Вам также может понравиться