




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





COMSATS-Lancaster Dual Degree Programme
Q1. Explore magic() command of MATLAB. Try A = magic(5), record your output and explain.
Q2. Consider two polynomials p ( s)= s^2 +2s+a and q (s)=s+1. Using MATLAB, find p(s)*q(s) Roots of p(s) and q(s) -1) and q(6) Write code and record output.
Q3. Use MATLAB to find partial fraction of the following B(s) /A(s)= 2s^3 +5s^2 +3s+6 / s^3 +6s^2 +11s+ B(s) /A(s )=s^2 +2s+3 / (s+1)^3
Q4. Use MATLAB to generate the first 100 terms in the sequence a(n) define recursively by a(n+1)= Pa(n) (1-a (n )) with p=2.9 and a(1) = 0.5.
Q5. Use for or while loop to convert degrees Fahrenheit to degrees Celsius using the following equation Tf =9/5 Tc+ Use any starting temperature, increment and ending temperature (example: starting temperature=0, increment=10, ending temperature = 200).
Q1(ans.):-
The command magic creates a square matrix which is less than the square of number entered within the round brackets of magic command. Syntax:-
magic(5)
r2 =
r3 =
r4 =
0
r5 =
Q3(ans.):-
b=[2 5 3 6] a=[1 6 11 6] [r,p,k] = residue(b,a)
b =
2 5 3 6
a =
1 6 11 6
r =
-6. -4.
p =
-3. -2. -1.
k =
2
(ii).
b=[1 2 3] a=[1 3 3 1] [r,p,k] = residue(b,a)
Q5(ans.):-
for Tc = 0:10: Tf=9/5.*Tc+ end
Tf =
Tf =
Tf =
Tf =
Tf =
374
Tf =
392