Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

S.S. B.E.

-III Chemical

Subject: Computational Techniques in Chemical Engineering

Lab Teachers: gargi trivedi, Amarsinh Mangrola,gaytri parikh,


bhavyata patel,kalpana kuntal
Assignment-3

Date: 15/02/2022

 Write Syntax, description and example for each command.


1. Perform diary command.

2. Plot the following graphs and give appropriate title, legend, labels, different colours and
markers.
 Plotting one graph in one figure window:
a. y = x 2 in the interval [−2,2]. (Using colon operator)
b. y = x 3 − 4x − 9 in the interval [2,3]. (Using linspace() function)

 Plotting two graphs in two figure windows: (Using figure command and xlim()
command)
a. y = sin(x) and z = cos(x) in the interval [−2π, 2π].
b. y = sin−1(x) and z = cos−1 (x) in the interval [−1,1].

 Plotting three graphs in three figure windows: (Also use grid on in each graph)
a. y1 = cosx − xex in the interval [−1,1] , y2 = cos x − 3x + 1 in the interval
π π
[− , ] and y3 = 2x − log10 x − 7 in the interval [3,4].
2 2

 Plot two graphs in same figure window:


 Using hold on/hold off
a. y = t sin t and z = t cos t in the interval [0, 10π]
 Using plot (x, y, ’^r’, x, z, ’og’)
sin(x)
a. y = x
and z = cos(x) in the interval [−3π, 3π]

 Multiple graphs in same figure window: (Using subplot(m, n, p))


Divide the figure window as shown in the sketch below:

(1) 2 rows and 2 columns (2) 1 rows and 3 columns (3) 3 rows and 1 column

Figure window Figure window Figure window

G1 G2 G1 G2 G3 G1

G3 G4 G2

G3

*G means Graph
(1) C = 4e−2t + e−0.1t in the interval [1,7] , y = x 4 + x 3 – 7x 2 – x + 5 in the interval
t
[2,3] , z = t 2 cos(3t) in the interval [−3π, 3π] and w = t sin (2) in the interval [0,2π].

(2) y1 = x sin x + cos x in the interval [−π, π] , y2 = 2x − 3 sin x − 5 in the interval [0,2π],
y3 = x log e x − 1.2 in the interval [2,3].
3
(3) y1 = √x 3 − x in the interval [−3,3] , y2 = sin x ∙ sin 2x in the interval [0, 2π] and y3 =
ln(x 2 − 4x + 5) in the interval [−2,5].

 Plotting using fplot:


x
a. f(x) = e−10 sin(x) ; 0 < x < 20
b. 𝑓 (𝑥) = tan(𝑥) ; [−5𝜋, 5𝜋]

 Plotting of Polar Curves: (Using polar command)


a. r 2 = 2 sin 5t ; 0 ≤ t ≤ 2π
b. r = 3 – 3 cos θ ; 0 ≤ θ ≤ 2π
c. 𝑟 = 1 − 2 sin 𝜃 ; 0 ≤ 𝜃 ≤ 2𝜋

 Plotting using comet command:


a. y = cos x ∙ cos 3x ; 0 ≤ 𝑥 ≤ 2𝜋
b. 𝑧 = 𝑒 −𝑡 ∙ 𝑡 2 ; 0 ≤ 𝑡 ≤ 10

 Plotting Commands in Octave:


 linspace(),plot(),xlabel(),ylabel(),legend(),title(),
fplot(),comet(), subplot(), grid on, grid off, hold on,
hold off, polar(),xlim(),ylim()

You might also like