Lab1 Tasks C
Lab1 Tasks C
TASKS
HAFIZ TALHA
Exercise 1:
MATLAB M-file Script
Use MATLAB to generate the first 100 terms in the sequence a (n) define
recursively by
a (n + 1) = p a(n) (1 a(n))
with p=2.9 and a(1) = 0.5
Solution:
HAFIZ TALHA
HAFIZ TALHA
HAFIZ TALHA
HAFIZ TALHA
CONTROL SYSTEM 1
2
HAFIZ TALHA
HAFIZ TALHA
HAFIZ TALHA
HAFIZ TALHA
Exercise 2:
MATLAB M-file Function
Consider the following equation
Y (t) = [y (0) -t sin (n (1-2)*t+)] / (1-)
a) Write a MATLAB M-file function to obtain numerical values of y (t).
Your function must take y (0), , n, t and as function inputs and y (t) as
output argument.
b) Obtain the plot for y (t) for 0<t<10 with an increment of 0.1, by
considering the following two cases.
CONTROL SYSTEM 2
3
Solution:
(a)
(b)Case 1
CONTROL SYSTEM 3
4
(b)Case 2
Exercise 3:
MATLAB Flow Control Use for or while loop to convert degrees
Fahrenheit (Tf) to degrees Celsius using the following equation Tf = (9/5) Tc +
32. Use any starting temperature, increment and ending temperature (example:
starting temperature=0, increment=10, ending temperature = 200).
Solution:
CONTROL SYSTEM 4
5
Exercise 4:
Plot the function
Y(x) = exp (-x) sin (8x) for 0 x 2.
Solution:
CONTROL SYSTEM 5