[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.
- lsim() trims time vector in an odd fashion, rocketsound, 2014/11/20
- Re: lsim() trims time vector in an odd fashion, Lukas Reichlin, 2014/11/20
- Re: lsim() trims time vector in an odd fashion, rocketsound, 2014/11/21
- Re: lsim() trims time vector in an odd fashion, Lukas Reichlin, 2014/11/21
- Re: lsim() trims time vector in an odd fashion,
rocketsound <=
- Re: lsim() trims time vector in an odd fashion, rocketsound, 2014/11/26
- Re: lsim() trims time vector in an odd fashion, Lukas Reichlin, 2014/11/26
- Re: lsim() trims time vector in an odd fashion, Lukas Reichlin, 2014/11/30
- Re: lsim() trims time vector in an odd fashion, rocketsound, 2014/11/30