How can I clarify an undefined function response in MATLAB?

7 visualizaciones (últimos 30 días)
So I've been tweaking a very simple code to plot a few functions in MATLAB using the step and tf functions coupled with the laplace and ilaplace to generate a few graphs. I first wanted to generate an ideal step response for a few inputs in the form of a transfer function, then move on to more realistic estimates using a form of the Boltzmann Sigmoid eqn, assuming several constant values. I've included the full code below for reference.
%%Ideal Unit Step Response %%
w0 = 1; %rad/s%
zeta = 0.15; %damping ratio%
wn = (w0)/((1-(zeta^2))^(1/2));
R = 1;
num = (wn^2);
den = [1 (2*zeta*wn) (wn^2)];
Ideal = tf(num,den);
t=0:0.1:30;
step(R*Ideal,t);
axis([0 30 0 2]);
stepinfo(Ideal)
%%Boltzmann Sigmoid Function (time domain method) %%
a = 0;
b = 1;
c = 6;
T = 0.1;
s = a+b/(1+exp(c*(T-1)));
% sym('Ideal');
h = ilaplace(Ideal);
y = conv(s,h);
%%Boltzmann Sigmoid Function (s-domain method) %%
S = laplace(s);
Y = S*Ideal;
y = ilaplace(Y);
The Ideal step response runs fine, but the time domain method using the approximation function stumps with
"Undefined function 'ilaplace' for input arguments of type 'tf'."
Similarly, the S domain method yields a
"Undefined function 'laplace' for input arguments of type'double'."
Is there any insight as to what may cause these issues? I thought maybe the code didn't like solving both a TF and an ilaplace at the same time, so I used the 'sym' function, but it seemed to not work. :/

Respuesta aceptada

Walter Roberson
Walter Roberson el 15 de Nov. de 2017
Editada: Walter Roberson el 16 de Nov. de 2017
tf creates a transfer function object; even if you use tf('s'), that is a transfer function object.
laplace() and ilaplace() are symbolic toolbox, and do not take accept transfer function objects. The File Exchange routine linked to above shows how to extract information from a transfer function and use it with symbolic ilaplace
  4 comentarios
Michael Dupre
Michael Dupre el 16 de Nov. de 2017
Output argument "ans" (and maybe others) not assigned during call to "ilaplacetf".
Unfortunately there appears to be a small hiccup inside the custom function. Time to go diving.
Walter Roberson
Walter Roberson el 16 de Nov. de 2017
ans is a special name; at some point the behaviour when you used ans as the output variable name changed. I recommend just changing the references from ans to some other otherwise unused variable name... for example output

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by