h(z)=2+10z^-1+2.3z^-2+3z^-3/1-78z^-1-9z^-2+59z^-3+1-31z^-1+16z^-2+4z/1-4z^-2-7z^-2
1 view (last 30 days)
Show older comments
help me to write code
3 Comments
Star Strider
on 25 Oct 2021
Needs parentheses and multiplication operators —
z = tf('z', 'Variable','z^-1')
h = (2+10*z^-1+2.3*z^-2+3*z^-3)/(1-78*z^-1-9*z^-2+59*z^-3) + (1-31*z^-1+16*z^-2+4*z)/(1-4*z^-2-7*z^-2)
I have no idea what is causing the ‘Invalid text character’ error. You need to solve that.
I tested the essential code with another transfer function, and it works correctly otherwise.
.
ALESSIO LEREDE
on 31 Oct 2021
Maybe you can try to define this transfer function with the function poles and zeros if you have issues in this form
Answers (1)
Image Analyst
on 31 Oct 2021
Try this:
z = linspace(0, 5, 200);
num1 = 10 .* z .^ (-1) + 2 .* z .^ (-2) + 3 .* z .^ (-3);
denom1 = 1-78*z.^(-1)-9*z.^(-2)+59*z.^(-3);
num2 = 1 - 31 * z.^(-1) - 16*z.^(-2)+4*z.^(-3);
denom2 = 1 - 4*z.^(-1)-7*z.^(-2);
h = 2 + num1 ./ denom1 + num2 ./ denom2;
plot(z, h, 'b-', 'LineWidth',2)
xlabel('z', 'FontSize', 17)
ylabel('h', 'FontSize', 17)
yline(0, 'LineWidth', 2)
grid on;

1 Comment
Image Analyst
on 31 Oct 2021
Edited: Image Analyst
on 31 Oct 2021
Not sure if the last term in numerator 2 is 4*z or 4*z^(-3) because the image is chopped off there. Please check. Here is is for 4z
z = linspace(0, 3, 200);
num1 = 10 .* z .^ (-1) + 2 .* z .^ (-2) + 3 .* z .^ (-3);
denom1 = 1-78*z.^(-1)-9*z.^(-2)+59*z.^(-3);
num2 = 1 - 31 * z.^(-1) - 16*z.^(-2)+4*z;
denom2 = 1 - 4*z.^(-1)-7*z.^(-2);
h = 2 + num1 ./ denom1 + num2 ./ denom2;
plot(z, h, 'b-', 'LineWidth',2)
xlabel('z', 'FontSize', 17)
ylabel('h', 'FontSize', 17)
yline(0, 'LineWidth', 2)

See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!