You are on page 1of 6

MATLAB

Tutorial 1
1. Write a program to calculate
a. Area of a circle
Area r 2

b. Reynold number
N

Dv

where,
D = 2 in. , v = 10 ft/s , = 62.4 lb/ft3 , = 0.3 lb/(hrft)
c. Heat capacity
Cp = 6.945 + 10.01 x 10-3 T 3.794 x 10-6 T2
when T = 400 K. Cp has the unit of cal/(g molK).

2. Prepare an innovative program to calculate the following heat capacity problem using
function block (Fcn).
Cp = 6.9 + 0.02884 x 10-2 T + 0.02429 x 10-5 T 2 -0.08052 x 10-9 T 3

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

Tutorial 2
Introduction

Familiarization with Simulink blocks

Sources: Constants, Step, Ramp.

Sinks: Display, Scope

Operations: Sum, Product, Add, Divide, Math functions, Special functions.

Signal processing blocks: Mux and Demux.

Data saving blocks: To Workspace.

Data saving at Matlab command window.


Mathematical operations involving blocks for sources, sinks, operations and data
saving blocks and data saving at Matlab command window.
Sources

Operations

Sinks

1
Constant

Scope
Demux

simout
Ramp

To Workspace

Mux

Step

12:34
Digital Clock

Tutorial 3

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

1. Prepare and run simulink block for the following:

slope = 1

Ramp1
slope = -1

Scope
Mux

Ramp2

Result

2. Prepare and run simulink block for the following:

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

3. Prepare simulink block for the following:

i)
ii)
iii)

Set simulation parameters to 600.


Run the simulation.
Plot PV vs time in command windows.
>> plot(time,PV)

Tutorial 4

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

Familiarization with Simulink blocks

Sources: Constants, Step, Ramp, Digital clock.

Sinks: Display, Scope

Operations: Sum, Product, Add, Divide, Math functions, Special functions.

Signal processing blocks: Mux and Demux.

Data saving blocks: To Workspace.

Data saving & plot at Matlab command window.


Mathematical operations involving blocks for sources, sinks, operations and signal
splitting.

1. Compare y = x2 and y = x3 graphically. Copy the plot to MSWORD.


2. Prepare and run simulink block for the following:
Source

Operation

Sink

x
To Workspace1

u[1]^3
Clock

Fcn

Scope

y
To Workspace

3. Set To Workspace, To Workspace1 data saving format to Array and variable name to y
and x respectively.
4. Run the program for Fcn u[1]^2 first.
5. At Matlab command window type >> plot(x,y)
6. Run the program for Fcn u[1]^3
7. At Matlab command window type >> figure(2), plot(x,y)
8. Copy line plot from Figure 2 to Figure.
9. At Figure, click Edit Copy Figure
10. Open MSWORD and paste.
11.

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

1000
900
800
700

600

y = x3

500
400
300

y = x2

200
100
0

5
X

10

12. Get your self acquainted with all command in Figure (File, Edit, View, etc.) esp. Property
Editor to label x, y axes and Text Arrow to label line plots.

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)