14
Pamantasan ng Lungsod ng Maynila University of the City of Manila Intramuros, Manila College of Engineering and Technology Computer Engineering Department CPE 415.1 Digital Signal Processing (Laboratory) ACTIVITY 2 Francisco, Marion Angelo V. Sinfuego, Ian C. Yamson, Eirry Rose Anne R. BS CpE 4 - 1

Linear and Nonlinear Systems

Embed Size (px)

DESCRIPTION

Linear and Nonlinear Systems

Citation preview

Page 1: Linear and Nonlinear Systems

Pamantasan ng Lungsod ng MaynilaUniversity of the City of Manila

Intramuros, Manila

College of Engineering and TechnologyComputer Engineering Department

CPE 415.1

Digital Signal Processing (Laboratory)

ACTIVITY 2

Francisco, Marion Angelo V. Sinfuego, Ian C. Yamson, Eirry Rose Anne R.

BS CpE 4 - 1

Engr. Juarizo

July 31, 2015

Page 2: Linear and Nonlinear Systems

Linear and Nonlinear Systems

Consider the system is given by:

y[n]−0.4 y[n−1]+0.75 y[n−2] = 2.2403 x[n]+2.4908 x[n−1]+2.2403 x[n−2]. (2.15)

Objective: To generate three different input sequences x1[n], x2[n], and x[n] = a · x1[n]+b · x2[n], and to compute and plot the corresponding output sequences y1[n], y2[n], and y[n].

% Program P2_3% Generate the input sequencesclf;n = 0:40;a = 2;b = -3;x1 = cos(2*pi*0.1*n);x2 = cos(2*pi*0.4*n);x = a*x1 + b*x2;num = [2.2403 2.4908 2.2403];den = [1 -0.4 0.75];ic = [0 0]; % Set zero initial conditionsy1 = filter(num,den,x1,ic); % Compute the output y1[n]y2 = filter(num,den,x2,ic); % Compute the output y2[n]y = filter(num,den,x,ic); % Compute the output y[n]yt = a*y1 + b*y2;d = y - yt; % Compute the difference output d[n]% Plot the outputs and the difference signalsubplot(3,1,1)stem(n,y);ylabel(’Amplitude’);title(’Output Due to Weighted Input: a \cdot+ x_{1}+[n] + b \cdot+ x_{2}+[n]’);subplot(3,1,2)stem(n,yt);ylabel(’Amplitude’);title(’Weighted Output: a \cdot+ y_{1}+[n] + b \cdot+y_{2}+[n]’);subplot(3,1,3)stem(n,d);xlabel(’Time index n’); ylabel(’Amplitude’);title(’Difference Signal’);

Page 3: Linear and Nonlinear Systems

Questions:

Q2.7 Run Program P2 3 and compare y[n] obtained with weighted input with yt[n] obtained by combining the two outputs y1[n] and y2[n] with the same weights. Are these two sequences equal? Is this system linear?Answer:

These two sequences are equal and the system is linear.

Q2.8 Repeat Question Q2.7 for three different sets of values of the weighting constants, a and b, and three different sets of input frequencies.Answer:

At a = 3; b = -5; x1: f =0.5; x2: f =0.3

Page 4: Linear and Nonlinear Systems

At a = 4; b = 2; x1: f =0.06; x2: f = 0.4 : At a = 4; b = 2; x1: f =0.06; x2: f =0.4 :

The plots generated shows that the system is linear.

Q2.9 Repeat Question Q2.7 with nonzero initial conditions.

Answer:

At ic = [1 1]:

The two sequences are not equal and the system is nonlinear.

Page 5: Linear and Nonlinear Systems

Q2.10 Repeat Question Q2.8 with nonzero initial conditions.

Answer:

At a = 3; b = -5; x1: f =0.5; x2: f =0.3

At a = 4; b = 2; x1: f =0.06; x2: f =0.4 : At a = 4; b = 2; x1: f =0.06; x2: f =0.4 :

The system is nonlinear as shown in the plots generated.

Q2.11 Consider another system described by:

Page 6: Linear and Nonlinear Systems

y[n] = x[n] x[n − 1].Modify Program P2 3 to compute the output sequences y1[n], y2[n], and y[n] of the above system. Compare y[n] with yt[n]. Are these two sequences equal?

The two sequences are not the same. The system is nonlinear.

Project 2.4 Time-Invariant and Time-Varying Systems

Page 7: Linear and Nonlinear Systems

% Program P2_4% Generate the input sequencesclf;n = 0:40; D = 10;a = 3.0;b = -2;x = a*cos(2*pi*0.1*n) + b*cos(2*pi*0.4*n);xd = [zeros(1,D) x];num = [2.2403 2.4908 2.2403];den = [1 -0.4 0.75];ic = [0 0];% Set initial conditions% Compute the output y[n]y = filter(num,den,x,ic);% Compute the output yd[n]yd = filter(num,den,xd,ic);% Compute the difference output d[n]d = y - yd(1+D:41+D);% Plot the outputssubplot(3,1,1)stem(n,y);ylabel(’Amplitude’);title(’Output y[n]’);grid;subplot(3,1,2)stem(n,yd(1:41));ylabel(’Amplitude’);title([’Output Due to Delayed Input x[n ’, num2str(D),’]’]);grid;subplot(3,1,3)stem(n,d);xlabel(’Time index n’); ylabel(’Amplitude’);title(’Difference Signal’);grid;

Questions:

Page 8: Linear and Nonlinear Systems

Q2.12 Run Program P2 4 and compare the output sequences y[n] and yd[n - 10]. What is the relation between these two sequences? Is this system time-invariant?

Answer:

y[n] is equal to yd[n - 10] but delayed by 10. The system is time-invariant.

Q2.13 Repeat Question Q2.12 for three different values of the delay variable D.

Answer:

At D = 3:

Page 9: Linear and Nonlinear Systems

At D = 5 : At D = 7 :

At D = 3; D = 5; D = 7 the sequence is delayed by 3, 5, and 7 respectively. The system is time-invariant.

Q2.14 Repeat Question Q2.12 for three different sets of values of the input frequencies.

Answer:

At x:f1 = 0.3, f2 = 0.5

The sequence is delayed by 10. The system is time-invariant.

Page 10: Linear and Nonlinear Systems

Q2.15 Repeat Question Q2.12 for nonzero initial conditions. Is this system time-invariant?

Answer:

The shift of yd[n] is not same with y[n]. The system is time varying.

Q2.16 Repeat Question Q2.14 for nonzero initial conditions. Is this system time-invariant?

Answer: not given by

At D = 3 :

Page 11: Linear and Nonlinear Systems

At D = 5: At D = 7:

The shift of the sequence yd[n] is not the same with y[n]. The system is time varying.

Q2.17 Consider another system described by:y[n] = nx[n] + x[n − 1]. (2.16)

Modify Program P2 4 to simulate the above system and determine whether this system istime-invariant or not.

yd[n] is not equal to y[n]. The system is time – varying y[n].

Page 12: Linear and Nonlinear Systems

Q2.18 (optional) Modify Program P2 3 to test the linearity of the system of Eq. (2.16).

Answer:

The system is linear.