How can I clarify an undefined function response in MATLAB?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Michael Dupre
le 15 Nov 2017
Commenté : Walter Roberson
le 16 Nov 2017
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. :/
0 commentaires
Réponse acceptée
Walter Roberson
le 15 Nov 2017
Modifié(e) : Walter Roberson
le 16 Nov 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 commentaires
Walter Roberson
le 16 Nov 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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!