Question on modelling system dynamics
Afficher commentaires plus anciens
I need to define a step input that starts at t =6 seconds only. Thus, I cannot use the in built step command. Ultimately i wish to model the dynamic response of a system in response to this input
How do I create a user defined function that does this?
I wrote a function
function [ res ] = mystep( a, b ) %Calculates the response ta a unit step input %with delay of 6 seconds
s=heaviside(b-6);
res = a*s;
end
But when i attempted to use it as follows >> num = [0,1]; den = [0,1]; G= tf(num, den); t = 0:0.1:10; Sys_Resp = mystep(G,t); plot(t,Sys_Resp) Error using plot Conversion to double from tf is not possible.
I get the above error. What have i done wrong?
1 commentaire
Azzi Abdelmalek
le 29 Oct 2012
num = [0,1]; den = [0,1]
then G=1
Réponses (1)
Azzi Abdelmalek
le 29 Oct 2012
N=1;D=[1 2];
G=tf(N,D)
t1=0:0.1:6;
t2=6+0.1:0.1:20;
t=[t1 t2]
u_step=ones(1,length(t))
u_step(1:length(t1))=0
plot(t,u_step)
lsim(G,u_step,t)
Catégories
En savoir plus sur Get Started with Control System Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!