help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lsim() trims time vector in an odd fashion


From: rocketsound
Subject: Re: lsim() trims time vector in an odd fashion
Date: Sun, 23 Nov 2014 09:28:05 -0800 (PST)

Yes, I get the same results. I noticed this approach works only if the system
supplied to lsim is discrete (i.e. if I replace discreteSystemZOH with
continousSystem in my example code it wont work and I get "invalid time
vector") but I guess this behaviour is correct.

I rewrote the example and shortend it to the relevant lines if this helps
you:

> clear
> 
> t_f = 5*1;
> N = 50*1;
> h = t_f/N;
> t_vec = zeros(N + 1, 1);
> for i = 2:length(t_vec)
>     t_vec(i) = t_vec(i - 1) + h;
> end
> u_vec = zeros(N + 1, 1);
> for i = 2:length(u_vec)
>     u_vec(i) = rand;
> end
> x_0 = [1, -0.8];
> 
> sys = c2d(ss([0, 1; 2, -3], [0;  1], [], []), h, 'zoh');
> [y_out, t_out, x_out] = lsim(sys, u_vec, t_vec, x_0);





--
View this message in context: 
http://octave.1599824.n4.nabble.com/lsim-trims-time-vector-in-an-odd-fashion-tp4667401p4667447.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]