help-octave
[Top][All Lists]
Advanced

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

Re: lsim problem


From: Ada Cheng
Subject: Re: lsim problem
Date: Wed, 20 Oct 2004 16:23:34 -0400 (EDT)

If you look at the code of lsim, it requires rows(u)=length(t). In your case, rows(u)=1 while the length(t) is 2001. So replace u with u'.

Ada

On Wed, 20 Oct 2004, Gerrit wrote:

Hello,

I am having a homework assignment which involves lsim. The homework
assignment was designed for Matlab, but i'm trying to solve it with
Octave. I already converted some necessary things (tf -> sys, freqresp
-> __freqresp__ (why?)), but I'm stuck with lsim. My input is currently
this:

G = tf2sys([1], [2, 2, 1]);
t = 0:.01:20;
u = exp(-t) + sin(t*2)/5;
[y, tt] = lsim(G, u, t); % literally taken from homework assignment
plot(t, u, 'r', tt, y, 'b');

The fourth line gives the following error message:

error: lsim: There should be an input value (row) for each time instant
error: evaluating if command near line 59, column 3
error: called from `lsim' in file 
`/usr/share/octave/2.1.50/m/control/base/lsim.m'
error: near line 12 of file `/srv/www/studie/s_en_t/opg23.m'

I don't understand this error message. The dimensions of u and t are
obviously the same: doesn't that mean there is an input value for each
time instant? How do I convert u and t so that it will work as it
probably is supossed to work with Matlab?

(sorry, I can't test it with Matlab: i don't own Matlab. The reason I'm
using Octave is a money reason)

yours,
Gerrit Holl.

--
Weather in Twenthe, Netherlands 20/10 21:25:
        16.0??C   wind 2.7 m/s SSE (57 m above NAP)
--
Ervaringen met het Syndroom van Asperger:
        http://topjaklont.student.utwente.nl
Socialistische Partij:
        http://www.sp.nl/



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



============================================================================
 Ada Cheng                              address@hidden
 Assistant Professor                    http://www.kettering.edu/~acheng
 Department of Science and Mathematics
 Kettering University
 1700 West Third Avenue
 Flint, Michigan 48504-4898
 U.S.A.
============================================================================

reply via email to

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