Question on modelling system dynamics
Mostrar comentarios más antiguos
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 comentario
Azzi Abdelmalek
el 29 de Oct. de 2012
num = [0,1]; den = [0,1]
then G=1
Respuestas (1)
Azzi Abdelmalek
el 29 de Oct. de 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)
Categorías
Más información sobre Get Started with Control System Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!