Question

A causal discrete-time system is described by the following difference equation: Use Matlab to write a script to complete the following tasks. Turn in the output created by the Matlab publish utility. (a) Compute and plot the impulse response h[n], 0くn 〈 50. Use the function h=imp2(b, a , N ) to find the impulse response, and use the stem ) function to create the plot. (b) Let x[n] be defined by (n - 15)2 0n K 30 x[n] elsewhere Compute and plot the output yn for0 n K 75 using the function y-filter (b,a, x); c) Repeat 2b, this time using the function y conv (h,x) (d) Use your script to verify that the two results are the same.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:-

Given differential equation is (In the question there is some ambiguity in the differential equation there is a sign missing between y(n), x(n) terms)

y(n) 1.3y(n-1) _ 0.72y(n-2) _ 0.081y(n-3) + 0.3645y(n-1) + 2.0x(n) 2.8x(n - 1) +1.6x(n -2)-0.4r(n -3) - 1.2r(n - 4)

In order to use the impz(b,a) we need to compute the transfer function and hence b(The coefficients int he denominator), a (coefficients in the numerator) .

a) To find the transfer function, Applying z transform on either side,

y(z) = У(z)(1.3~-「一0.72,-2-0.08 1 ~-3 + 0.3645~-4) + X(z)(2.0 + 2.82-1 1.622-0.4z3- 1.2z4)

y(z)(1-1.3:-「+0.72~-2 +0.081,-3-0.3645,-4) = Χ(z)(2.0+2.8:-4 1.6~-2-0.4~-3-1.2t-4)

H(z) = Y(s) X (z) 2.0+282-1 1-1.3:-1 나 1.6,-2-0.4~-3-1.2之一4 0.72:ー2 _ 0.081,-3-0.3645:-4)

So

b = [1 -1.3 0.72 0.081 0.3645];
a = [2 2.8 1.6 -0.4 -1.2];

%Matlab code for part a.

% defining the numerator and denominator

b = [1 -1.3 0.72 0.081 0.3645];
a = [2 2.8 1.6 -0.4 -1.2];

%Computing impulse respnse and plotting
h = impz(b,a);

figure;stem(h);xlabel('n, samples');

ylabel('h(n)');title('Impulse response');

Output of this code:

Impulse response 2 1.5 0.5 Q -0.5 -1 0 2468 10 12 1416 18 20 n, samples

B) In the following code the input signal is defined and the output of the filter is computed using filter function

% Defining the signal
n = 0:75;
for i = 0: 75
    if(i<=30)
        x(i+1) = (i)*(30-i);
    else
        x(i+1) =0;
    end
end
stem(n,x);xlabel('n, samples');ylabel('x(n)');title('Input signal');
% Finding the output using Fitler
yfilt = filter(b,a,x);
stem(n,yfilt);xlabel('n, samples');ylabel('y(n)');title('Output signal using filter function');

Output for the above code:

Input signal 250 200 150 100 50 10 20 30 40 50 60 70 80 n, samples

Output signal using filter function 60 50 40 30 20 E 10 10 FO -20 30 40 10 20 30 40 50 60 70 80 n, samples

C) The Matlab code for part C is given below

ycon = conv(h,x);
n = 0:length(x)+length(h)-2;
figure,stem(n,ycon);xlabel('n, samples');ylabel('y(n)');title('Output signal using convolution');

The output of the code is Output signal using convolution 140 120 100 80 60 40 20 Fo -20 0 10 20 30 40 50 60 70 80 90 100 n, samples

The output of the filter function and the output of convolution function are not the same. Filter function computes the output which will have same length of x while the conv function computes the full linear convolution which is of length =length(x)+length(h)-1.

Add a comment
Know the answer?
Add Answer to:
A causal discrete-time system is described by the following difference equation: Use Matlab to write a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For a causal LTI discrete-time system described by the difference equation:

    For a causal LTI discrete-time system described by the difference equation: y[n] + y[n – 1] = x[n] a) Find the transfer function H(z).b) Find poles and zeros and then mark them on the z-plane (pole-zero plot). Is this system BIBO? c) Find its impulse response h[n]. d) Draw the z-domain block diagram (using the unit delay block z-1) of the discrete-time system. e) Find the output y[n] for input x[n] = 10 u[n] if all initial conditions are 0.

  • A causal discrete-time LTI system is described by the equation

    A causal discrete-time LTI system is described by the equationwhere z is the input signal, and y the output signal y(n) = 1/3x(n) + 1/3x(n -1) + 1/3x(n - 2) (a) Sketch the impulse response of the system. (b) What is the dc gain of the system? (Find Hf(0).) (c) Sketch the output of the system when the input x(n) is the constant unity signal, x(n) = 1. (d) Sketch the output of the system when the input x(n) is the unit step signal, x(n)...

  • For the causal filter below y(n) x(n) -20 eja 1-0.8e10 Write the difference equation(show the equation...

    For the causal filter below y(n) x(n) -20 eja 1-0.8e10 Write the difference equation(show the equation clearly and define coefficients) Give and plot the frequency response magnitude (show the equation clearly) Compute and plot the impulse response using MATLAB d a. b. c. Use MATLAB to determine steady state response due to x(n)-u(n) Write a MATLAB program to compute and plot the frequency response of the overall system. Give plots in dB and the program e. For the causal filter...

  • For the causal filter below y(n) x(n) -20 eja 1-0.8e10 Write the difference equation(show the equation...

    For the causal filter below y(n) x(n) -20 eja 1-0.8e10 Write the difference equation(show the equation clearly and define coefficients) Give and plot the frequency response magnitude (show the equation clearly) Compute and plot the impulse response using MATLAB d a. b. c. Use MATLAB to determine steady state response due to x(n)-u(n) Write a MATLAB program to compute and plot the frequency response of the overall system. Give plots in dB and the program e. For the causal filter...

  • 6. (15) Consider the following causal linear time-invariant (LTT) discrete-time filter with input in and output...

    6. (15) Consider the following causal linear time-invariant (LTT) discrete-time filter with input in and output yn described by y[n] = x[n] – rn - 2 for n 20 . Is this a finite impulse response (FIR) or infinite impulse response (IIR) filter? Why? • What are the initial conditions and their values for this causal and linear time-invariant system? Why? • Draw the block diagram of the filter relating input x[n) and output y[n] • Derive a formula for...

  • For the causal filter below x(п) y(n) -2j0 1 -0.8e 2j0 Write the difference equation(show the...

    For the causal filter below x(п) y(n) -2j0 1 -0.8e 2j0 Write the difference equation(show the equation clearly and define coefficients) а. b. Give and plot the frequency response magnitude (show the equation clearly) Compute and plot the impulse response using MATLAB Use MATLAB to determine steady state response due to x(n)=u(n) c. d. Write a MATLAB program to compute and plot the frequency response of the overall system. Give plots in dB and the program e. For the causal...

  • Problem 2 Consider the causal non-linear discrete-time system characterized by the following diff...

    Problem 2 Consider the causal non-linear discrete-time system characterized by the following difference equation: 2y[n] yn-1]+x[n] /yn-] If we use as input x[n] to this system (algorithm) a step function of amplitude P (i.e. xIn]-P u[n]), then y[n] will converge after several iterations to the square root of P .Write a MATLAB program that implements the above recursion to compute the square . How many iterations does it take to converge to the true value starting at y[-1]-0.2? roots of...

  • 1) A causal discrete-time system is described by the difference equation, y(n) = x(n)+3x(n-1)+ 2x(n-4) a)...

    1) A causal discrete-time system is described by the difference equation, y(n) = x(n)+3x(n-1)+ 2x(n-4) a) What is the transfer function of the system? b) Sketch the impulse response of the system

  • please matlab code result is important 5. Consider a system with a cascade connection of two...

    please matlab code result is important 5. Consider a system with a cascade connection of two causal LTI systems: • Frequency response of the first system is H, (e) 1-2 and The impulse response of the second system is h, [n] = 5()'u[n] The input to the system is x[n], the output of the first system is w[n) and the output of the overall (complete) system is yn). a. Find the difference equation relating i. The input x[n) to the...

  • 2. A system is described by the following difference equation n]1.5y[n0.56y[n -2]+x{n-0.2x{n-] a) Find the transfer fun...

    2. A system is described by the following difference equation n]1.5y[n0.56y[n -2]+x{n-0.2x{n-] a) Find the transfer function of the system b) Let xn]un]. Compute an analytical expression for the response y[n]. Use Matlab to calculate the coefficients c) Simulate and plot the response using Matlab.(stem plot) Generate 50 points. (Matlab: x ones(1,50)); 2. A system is described by the following difference equation n]1.5y[n0.56y[n -2]+x{n-0.2x{n-] a) Find the transfer function of the system b) Let xn]un]. Compute an analytical expression for...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT