Lab 2
Lab 2
Lab 2
Institute of Technology
(An Autonomous Institute affiliated to Savitribai Phule Pune University formerly
University of Pune)
Class: ME C Batch: 2
LAB :- 2
Simulink Exercises
1. Modelling a First Order Equation (RC Circuit) The RC Circuit is schematically shown
below.
The differential equation is –
Solution :-
Block Diagram and Output :-
Fig :- 2.1
Description :-
1. To plot the f(t) function, we take Ramp block. For R and C, we take the constant blocks and
assume the values of each.
2. We use integrator block to convert the first derivative function to a single linear function. Then
we subtract x from f(t).
3. We reciprocate the R*C term and multiply it with the expression.
4. We get the final graph of the function in scope block.
Output :-
fig :- 2.2
Conclusion :- The graph for the function is displayed above. It starts at 0 and increases in a curve.
The response of this system is governed by the equation of motion which is a second-order
differential equation, and is shown-
Where (x-dot) is the acceleration of the mass m, (x-dot) is the velocity, x is the displacement,
f(t) is the forcing function (input force), c is the damping coefficient, and k is the spring
constant.
Solution :-
Fig :- 2.3
Description :-
1. We first take a Ramp block as f(t) function.
2. By using integrators, we convert double derivative to a linear function ‘x’.
3. We multiply x’ with c and x with k, assuming the values c = 5 and k = 4.
4. Then we finally obtain the expression using a subtract block.
5. Finally, we multiply the expression by reciprocal of m, where we assumed the value om = 3.
6. We plot the graph of the final function using a scope block.
Output :-
Solution :-
Block Diagram :-
Fig :- 2.5
Description :-
We take a sine wave as an input function first, with Amplitude 2 and Frequency 3 and multiply
it with 2.
We use an integrator for getting the value in linear function x. And then we multiply x by 4.
We subtract the second expression from the first and plot the resultant graph using a scope
block.
Output (graph) :-
Fig :- 2.6
Conclusion :-
By using Simulink-model we create a sign wave in which we get a gradually varying curve .
The following graph is obtained for the expression.
4. Solve the initial value problem-
Solution :-
Block Diagram :-
Fig :- 2.7
Description :-
We take clock as input and as it starts with 0, we add one.
We reciprocate it by using 1/u block and then give it a gain of 2.
We use integrator for integrating the function into linear form and multiply y by the previous
expression.
The graph of the function is displayed in scope block.
.
Output :-
Fig :- 2.8
Conclusion :- We get the following curve as an output.
5. If you take your hot cup of tea, and let it sit in a cold room, the tea will cool off and reach
room temperature after a period of time. The law of cooling is attributed to Isaac Newton
(1642-1727) who was probably the first to state results on how bodies cool.1 The main idea is
that a body .at temperature T(t) is initially at temperature T(0) = T0. It is placed in an
environment at an ambient temperature of Ta. The goal is to find the temperature at a later
time, T(t).We will assume that the rate of change of the temperature of the body is
proportional to the temperature difference between the body and its surroundings. Thus, we
have-
Solution :-
Block Diagram :-
Fig ;- 2.9
Description :-
We assume the value of dT/dt = 2 and then convert it into a linear function T by integrator block.
We subtract a value Ta = 15 by use of constant block and subtract block.
Then we assume a value of the proportionality constant as 1 and plot the graph in the scope.
Output :-
Fig :- 2.10
Conclusion :- The graph has a constant slope and it starts from -15.
6. A cup of tea at 90oC cools to 85oC in ten minutes. If the room temperature is 22oC, what is
its temperature after 30 minutes? Using the general solution with T0 = 90oC,
Solution :-
Block Diagram :-
Fig :- 2.11
Description :-
We take clock and add one to it as input.
We apply a -1 gain to it and then use the eu function for exponentiation.
We multiply that function to 68 and add 22 to the final function.
The graph of the function is displayed using slope.
Output :-
Conclusion :-
We get the following graph as output. This graph depicts
a negative exponential function.
Fig :- 2.12
Solution :-
Block Diagram :-
Fig:- 2.13
Description :-
First, we use integrator to convert a function from double derivative to single derivative.
Then we use another integrator to convert single derivative to a linear function.
The single derivative is applied a gain of 5 and then subtracted from the double derivative.
Similarly, the linear variable y is applied gain of 6 and subtracted from the double derivative.
The final function y is taken, and the graph is plotted of the model using the scope block.
Output :-
Fig :- 2.14
Conclusion :-
In this Simulink model we get such graph of the function. It has a peak value at 0.146.
Solution :-
Block Diagram :-
Fig :- 2.15
Description :-
We take a gain value of -1/m where we assume the value of m as 2.
We use 2 integrators to convert it to x.
We use another gain function for the value of k. we assume the value of k as 5.
Output :-
Fig ;- 2.16
Conclusion :-
We get the following curve similar to a cosine curve with the max and min values as 1 and -1.
Solution :-
Block Diagram :-
Fig :- 2.17
Description :-
We use 2 integrators to convert double derivative into linear function.
The double derivative is applied a gain of value m = 0.5, to get the mx’’ term.
The single derivative is applied a gain of b = 2 and then subtracted from the double derivative
term.
Similarly, the linear variable x is applied gain of k = 5 and subtracted from the double derivative
term.
The final function x is taken, and the graph is plotted of the model using the scope block.
Output :-
Fig :- 2.18
Conclusion :-
This is the graph for function mx” + bx’ + kx = 0, where m = 0.5, b = 2 and k = 5.
mL ¨θ = −mg sin θ
Solution :-
Block Diagram :-
By the equation mLθ = -mgsinθ, we can simplify it as, θ = -gsinθ/L.
So, we use constant block of value -9.81 to give it value of -g, we assume value of L = 5.
We use 2 integrators to convert double derivative of theta term to a linear term θ.
We use sin function on the theta and we multiply -g with sinθ, and divide it by L to get value
of θ.
We use scope to plot the graph of the expression.
Output :-
Conclusion:-
This is the graph for the function and the assumed value of L is 5.