You are on page 1of 4

Matlab Programming – Mechatronics Engineering – SPUP – 2019/2020

Name: Putri Wandini Student Reg. No. : 44419019

MATLAB 6.5.lnk

MATLAB PROGRAMMING

1
Matlab Programming – Mechatronics Engineering – SPUP – 2019/2020
Name: Putri Wandini Student Reg. No. : 44419019

TASK-01
Using Command Window
1. Open your Matlab Program. Let p = last two digits of your student
registration number (e.g. x = 12) and q = 2p. Determine the values of P, Q,
R, S and T by using the command window. Remember that Matlab’s variabel
is case sensitive.

a. P = 2p + p2
b. Q = x - P / 50q
c. R = 1.8Q / pi
d. S = absolut value of R
e. T = sin (pi / 0.1S)

Type these statements in the command window to find the answers.

>>P = p * 2 + p ^ 2
>>Q = p - P / 50*q
>>R = Q * 1.8 / pi
>>S = abs (R)
>>T = sin (pi/(0.1*S))

Write the answers in the below box.

P = 399
Q = -284.2400
R = -162.8575
S = 162.8575
T = 0.1917

2. Type these statements in the command window.

>> deret1 = 0:p/10:p


>> deret2=linspace(0,p/10,p)

2
Matlab Programming – Mechatronics Engineering – SPUP – 2019/2020
Name: Putri Wandini Student Reg. No. : 44419019

Copy the answers in the command window and paste it in the below box.

deret1 =

0 1.9000 3.8000 5.7000 7.6000 9.5000 11.4000 13.3000


15.2000 17.1000 19.0000

deret2 =

Columns 1 through 12

0 0.1056 0.2111 0.3167 0.4222 0.5278 0.6333 0.7389


0.8444 0.9500 1.0556 1.1611

Columns 13 through 19

1.2667 1.3722 1.4778 1.5833 1.6889 1.7944 1.9000

Based on the above answeer, explain the different between deret1 and deret2
in the below box. If you can’t write your answer in English, you can write it in
Bahasa.

Deret 1 angka pertama nol selisihnya adalah p/10 angka terakhirnya p


Deret 2 angka pertama nol selisihnya adalah 1.9 angka terakhirnya 19

3. Find the roots of this quadratic equation.

y1 = x2 - px - 2p2

Input the value of p to the equation. Retype the equation in the below box.

y1 = x2 - 19x - 2*172

Find the roots of the above equation by manual calculation first. Write your
answers in below box.

x1 = 38

3
Matlab Programming – Mechatronics Engineering – SPUP – 2019/2020
Name: Putri Wandini Student Reg. No. : 44419019

x2 = -19

Type this statement in the command window to find the roots.

akar1=roots([1 -p -2*p^2])

Copy the answers in the command window and paste it in the below box.

akar1 =

38
-19

4. Find the roots of this polinomial equation:

y2 = x4 – 10 x2 + 9

Type these statements in the command window.

akar2=roots([1 0 -10 0 9])

Copy the answers in the command window and paste it in the below box.

akar2 =

-3.0000
3.0000
-1.0000
1.0000

---end of T1---

You might also like