Why I have following error? unrecognized function or variable 'printsys'. Error at (line 5) printsys(num, den, 'z')
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Haziq Isa
el 12 de Dic. de 2021
Editada: Walter Roberson
el 14 de Jun. de 2025
clear all;
clc;
num=[0 1 5 4]; % nominator values
den=[1 -4 1 -2.5]; % denominator values
printsys(num, den, 'z')
[r,p,k]=residuez(num,den); % partial fraction expansion
zeros=roots(num); % to find the zeros values
poles=roots(den); % to find the poles values
0 comentarios
Respuesta aceptada
Walter Roberson
el 12 de Dic. de 2021
Change
printsys(num, den, 'z')
to
disp(tf(num, den, 'z'))
3 comentarios
Walter Roberson
el 14 de Dic. de 2021
residuez() is from the Communication Systems Toolbox.
roots() is from basic MATLAB.
printsys() is part of the Control System Toolbox, but does not appear to be indexed in the documentation any more. It is in the portion of Control System Toolbox functions marked as "obsolete"
help printsys
It is not part of the Symbolic Toolbox.
You can simulate it using the Symbolic Toolbox:
num=[0 1 5 4]; % nominator values
den=[1 -4 1 -2.5]; % denominator values
printsys(num, den, 'z')
function printsys(num, den, variable)
sv = sym(variable);
ns = char(poly2sym(num, sv));
n_ns = length(ns);
ds = char(poly2sym(den, sv));
n_ds = length(ds);
barlen = max(n_ns, n_ds);
fprintf('%s%s\n', blanks(floor((barlen-n_ns)/2)), ns);
fprintf('%s\n', repmat('-', 1, barlen));
fprintf('%s%s\n', blanks(floor((barlen-n_ds)/2)), ds);
end
You might notice that the coefficients are not in the standard order, with the powers increasing and then the constant last. This is caused by the char() operation that converts the symbolic expression generated by poly2sysm() to a character vector for display. The output of poly2sym() by itself looks fine, but to get the spacing right according to printsys(), we have to convert to character vectors -- we cannot generate the correct length of fraction bar without converting to character vectors.
It is possible to write code that (A) puts the coefficients in the standard order; and (B) gets the spacing the same as is used by printsys(); and (C ) gets the spacing right for subtractions; and (D) omits the multiplications between the constants and the symbols. Possible. And if you care to do that... go ahead ;-)
But probably by far the easiest thing is to install the Control System Toolbox in order to either use printsys() or tf()
Más respuestas (1)
Yerson
el 14 de Jun. de 2025
Unrecognized function or variable 'printsys'.
me aparece ese error que puedo hacer?
1 comentario
Walter Roberson
el 14 de Jun. de 2025
Editada: Walter Roberson
el 14 de Jun. de 2025
You do not have the Control System Toolbox installed.
Although printsys() is marked as obsolete, it is still present as of R2025a.
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

