Question
MatLab only

Problem B-2-17 Matlab only y Solve the following difference equation: x(k + 2) = x(k + 1) + 0.25x(k) - u(k + 2) where x(0) -
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Script:

clc;close all;clear all;

k=0:1:50;

%Initial values

x(1)=1;x(2)=2;

%Input

u=1.*(k>=0);

%using recursive method

for m=3:1:length(k)

%delayed difference equation

x(m)=(x(m-1)-0.25*x(m-2)+u(m));

end

figure;

stem(k,x);grid;

xlabel('n');ylabel('x(n)')

title('output x(n)')

output x(n) 3.5 3 2.5 2 FO 1.5 16 0.5 30 50 10 20 40 4)

Script2:

k=0:1:50;

%using filter command

b=1;a=[1 -1 0.25];

sys=tf(b,a);

x=filter(b,a,u);

figure;

stem(k,x);grid;

xlabel('n');ylabel('x(n)')

title('output x(n)')

output x(n) 3.5 3 2.5 2 FO 1.5 16 0.5 30 50 10 20 40 4)

Add a comment
Know the answer?
Add Answer to:
MatLab only Problem B-2-17 Matlab only y Solve the following difference equation: x(k + 2) =...
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
  • Styles Paragraph 6. Given the difference equation y(n)-x(n-1)-0.75y(n-1)-0.125(n-2) a. Use MATLAB function filterl) and filticl) to...

    Styles Paragraph 6. Given the difference equation y(n)-x(n-1)-0.75y(n-1)-0.125(n-2) a. Use MATLAB function filterl) and filticl) to calculate the system response y(n)for n 0, 1, 2, 3, 4 with the input of x(n (0.5) u(n)and initial conditions x(-1)--1, y(-2) -2, and y(-1)-1 b. Use MATLAB function filter!) to calculate the system response y(n) for n-0, 1, 2, 3,4 with the input of x(n) (0.5)"u(n)and zero initial conditions x(-1)-0, (-2)-0, and y(-1)-0 Design a 5-tap FIR low pass filter with a cutoff...

  • Practical 2: • A. Solve the following difference equations using the sequential method: y[k] – y[k...

    Practical 2: • A. Solve the following difference equations using the sequential method: y[k] – y[k – 1] = x[X] + x[k – 1] where x[k] = 0.8ku[k] and y-1) = 0. B. Plot the results for the range o sk s 20. • A. Solve the following difference equations using the z-transform: y[k] + 2.5y[k – 1] +y[k – 2] = x[k] + x[k – 1] where x[k] = 0.8ku[k]. B. Plot the results for the range o sk...

  • please solve then upload matlab code Thanks 1. The function f(z, y) (a-x)2 + b(y-12)2 is...

    please solve then upload matlab code Thanks 1. The function f(z, y) (a-x)2 + b(y-12)2 is called Rosenbrock's banana function. It is often used as a benchmarking test for optimization algorithms becatse it is easy to find the minimum by hand but often very difficult to find numerically. Throughout the problem, we will use the values a = 2 and b 10. You can plot this function using the following code: x3:0.1:3; y = -10:0.2:10; Cx,Ymeshgrid(x,y); Z(2-X).2 10* (Y-X. 2)....

  • Solve using MATLAB (1) Consider the difference equation given follows as у(п) — — 0.9у(п -...

    Solve using MATLAB (1) Consider the difference equation given follows as у(п) — — 0.9у(п - 1) — 0.81у(n — 2) + 1.62г(п) + 1.82(п — 1) + 2ar (п — 2), п > 0. Find and plot x(n) and y(n) and hence find the energy of y(n) for the following cases (а) 2(п) — 8(п — 2) (b) 2(п) — и(п) 6(п — 3) _ (с) г(п) — и(п)u(-п + 23) _ (d) x(n)r(n) - r(n - 25), where...

  • solve using matlab or by hand. For the following differential equation, answer the questions. -y"+y=x (0.0...

    solve using matlab or by hand. For the following differential equation, answer the questions. -y"+y=x (0.0 SX 35.0) y(0.0)=1.0, y(5.0)= 2.0 (1) Solve the differential equation analytically. (2) Solve the differential equation using centered finite difference approximation of y" with a step size of 1.0 and check the accuracy of the solutions.

  • Given the difference equation, y(n) -y(n-2)-x(n);n 2 y(-1) 1, y(-2)0, and the input x(n) a) yh (n...

    Please be neat and show all work. thank you. Given the difference equation, y(n) -y(n-2)-x(n);n 2 y(-1) 1, y(-2)0, and the input x(n) a) yh (n), p (n) and hence y (n) b) yzi (n), ½,( ) 1. 0, and the initial conditions as u(n), determine n) and hence v n Given the difference equation, y(n) -y(n-2)-x(n);n 2 y(-1) 1, y(-2)0, and the input x(n) a) yh (n), p (n) and hence y (n) b) yzi (n), ½,( ) 1....

  • 4. (20 points) Use z-transform to solve the difference equation y(k) -1.5y(k-1) + 0.56y(k-2) = x(k)...

    4. (20 points) Use z-transform to solve the difference equation y(k) -1.5y(k-1) + 0.56y(k-2) = x(k) for k> 0 with initial conditions y(-1) = 3, y(-2)=-4, and x(k)= kļu(k).

  • using matlab to solve this problem as soon as possible thanks use matlab to slove the...

    using matlab to solve this problem as soon as possible thanks use matlab to slove the problem as soon as possible solve the activity of number 1&2&3 by using matlab for this problem i need from you to solve activity one and two and three by using matlab DIRECTIONS: Perform the following using MATLAB. After the simulation, your report must be uploaded in the Moodle Learning system. ACTIVITY I. VECTORS AND ITS OPERATIONS Procedure 1: Define two vectors a and...

  • Solve using MAT-LAB codes: A. Solve the following difference equations using the sequential method: ylk] +1.5y[k-1]+0.5y[k-2]...

    Solve using MAT-LAB codes: A. Solve the following difference equations using the sequential method: ylk] +1.5y[k-1]+0.5y[k-2] x[k]+ x[k-1] where 0.8 uk] and and y[-2] = y[ - 1] 0 xk] B. Plot the results for the range 0 s ks 20. Solve using MAT-LAB codes: A. Solve the following difference equations using the sequential method: ylk] +1.5y[k-1]+0.5y[k-2] x[k]+ x[k-1] where 0.8 uk] and and y[-2] = y[ - 1] 0 xk] B. Plot the results for the range 0 s...

  • Problem 2. For the following system described by the difference equation where y[-1-y[-2] = 0 and...

    Problem 2. For the following system described by the difference equation where y[-1-y[-2] = 0 and x[n] = 2u[n]: a. Draw a block diagram of this system using delays, multipliers, and adders b. Determine the impulse response of the system, h[n], and plot it in MATLAB for n = 0, 1, ,20. (Hint: use Euler's Formula to simplify) c. Is this system stable? d. Determine the initial conditioned repsonse, in. e. Find the total response of the system, yn nln....

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