# Find the impulse response

์กฐํ ์: 21(์ต๊ทผ 30์ผ)
Marina Petani 2022๋ 5์ 21์ผ
๋๊ธ: Marina Petani 2022๋ 5์ 23์ผ
its given: ๐ฆ(๐)=๐ฅ(๐โ1)โ2.2๐ฅ(๐โ2)+๐ฅ(๐โ3)โ17๐ฆ(๐โ1)+3.123๐ฆ(๐โ2) and ๐ฅ(๐)=(0.9)๐[u(n)-u(n-8)]
find h(n) as an expression.
it doesnt work when i try this:
syms z
H = (z^-1 - 2.2 * z^-2 + z^-3)/(1 + 0.1429 * z^-1 - 3.123 * z^-2);
iztrans(H)
##### ๋๊ธ ์: 2ํ์์จ๊ธฐ๊ธฐ ์ด์  ๋๊ธ ์: 1
Marina Petani 2022๋ 5์ 22์ผ
Thank you. That was a typo. I should have typed 1/7.
The impulsive response turned out to be a very long expression and I am not sure if that is a correct answer. I was wondering if there was another solution for this problem without finding H(z) in the first place?
i dont understand where do i use the expression of x(n).

๋๊ธ์ ๋ฌ๋ ค๋ฉด ๋ก๊ทธ์ธํ์ญ์์ค.

### ์ฑํ๋ ๋ต๋ณ

Paul 2022๋ 5์ 22์ผ
Hi Marina,
Sometimes the Symbolic Math Toolbox works in mysterious ways and it is difficult to manipulate expressions into simpler forms. I do think that the result of your code is correct. However, a simpler form of the result can be obtained as follows,
Find the z-transform of the unit pulse response by hand
syms z
syms n integer
syms y(n) x(n)
H(z) = (z^-1 - 2.2 * z^-2 + z^-3)/(1 + 0.1429 * z^-1 - 3.123 * z^-2)
H(z)ย =ย
Let's check the roots of the denominator
[num,den] = numden(H(z));
solve(den)
ansย =ย
The roots are all real, so we should expect the solution have terms in a^n, where a is root of den (the root at 0 becomes a unit pulse). Note that the roots are outside the unit circle so the pulse response is unstable.
Break up H(z) into partial fractions
H(z) = partfrac(H(z),'FactorMode','full');
Now take the inverse z-transform
h(n) = iztrans(H(z))
h(n)ย =ย
The result is hard to read, but we can use vpa to get an approximation of the exact solution to see its form
vpa(h(n),5)
ansย =ย
The solution has the expected form.
We can verify the exact solution by plotting the first 11 outputs against the solution from the Control Systems Toolbox
htf = tf([0 1 -2.2 1],[1 0.1429 -3.123],-1,'Variable','z^-1')
htf = z^-1 - 2.2 z^-2 + z^-3 ---------------------------- 1 + 0.1429 z^-1 - 3.123 z^-2 Sample time: unspecified Discrete-time transfer function.
figure
impulse(htf,10);
hold on
stem(0:10,double(h(0:10)),'r')
As an aside, instead of computing the transfer function by hand, we can derive it using the tools at hand. It takes a few more steps, but mitigates the possibility of errors
x(n) = kroneckerDelta(n,0);
eq = y(n) == x(n-1) - 2.2*x(n-2) + x(n-3) - 0.1429*y(n-1) + 3.123*y(n-2)
eqย =ย
eq = ztrans(eq)
eqย =ย
syms Y
eq = subs(eq,[ztrans(y) y(-2:-1)],[Y zeros(1,2)]);
H1(z) = rhs(isolate(eq,Y))
H1(z)ย =ย
Verify that H1(z) is the same as H(z)
simplify(H1 - H)
ans(z)ย =ย
0
##### ๋๊ธ ์: 1ํ์์จ๊ธฐ๊ธฐ ์์
Marina Petani 2022๋ 5์ 23์ผ
Thank you a lot. That was really helpfull.

๋๊ธ์ ๋ฌ๋ ค๋ฉด ๋ก๊ทธ์ธํ์ญ์์ค.

R2022a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by