help-octave
[Top][All Lists]
Advanced

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

Re: time delay transfer function


From: Javier Arantegui
Subject: Re: time delay transfer function
Date: Fri, 6 Jul 2007 12:40:24 +0200
User-agent: KMail/1.9.7

Hello,

El Viernes, 29 de Junio de 2007, Claudiu Socaciu escribió:
> Hy is there a way to introduce in octave a time delay function.
> I got for example the folowing function : H(s)= [exp(-3*s)]*(s+1)/(s^2 +
> 2*s +1);
> I mean something like in matlab where u have the 'inputdelay' argument.
> Or any other way to simulate this transfer function in octave.

I've been waiting that somebody with more knowledge than me answered that 
question. I'm afraid that there is no easy way to deal with time delays using 
Octave. In some cases you could use Padé approximant (1). Octave doesn't have 
the Pade function. But, usually you need to deal with the time delay "by 
hand" using Laplace transform properies.

(1) 
http://www.mathworks.com/products/demos/shipping/control/MADelayResponse.html?product=CT


In some cases you could do thing in your own way. For example, the function to 
plot Bode diagrams of Octave is not able to deal with time delays. It's quite 
easy to write your own function to deal with them. This is what I wrote for 
that task. It's not the best code but I fills my needs:

function [ra,phi]=mybode(gol,delay,finf,fsup);
        lfinf=log10(finf);
        lfsup=log10(fsup);
        jump=(lfsup-lfinf)/200;
        lw=lfinf:jump:lfsup;
        w=10.^lw;
        s=i.*w;
        gla=eval(gol);
        ra=abs(gla);
        phi=(arg(gla)-delay*w)*180./pi;
        multiplot(1,2);
        gset size ratio .5;
        gset nokey;
        subwindow(1,1);
        grid;
        xlabel("omega");
        ylabel("RA");
        loglog(w,ra);
        subwindow(1,2);
        grid;
        xlabel("omega");
        ylabel("phi");
        semilogx(w,phi);
endfunction;

The use of this function is the following (using H(s)):

mybode("(s+1)/(s^2+2*s+1)",3,.01,100)

Probably this code won't work with newer versions of Octave because all the 
changes related to Gnuplot. But, it should be easy to adapt.


Other solution could be to use Scilab to do the simulations. Scilab has Scicos 
which is similar to Matlab's Simulink. In Scicos there is one block that 
represents the delay. Scicos is quite easy to understand and you don't need 
to learn a new language because you do everything graphically. The only 
problem is that the GUI is extremely old. I think that this will change on 
November when Scilab 5 will be released.

Javier




-- 
Javier Arántegui
Dept. Tecnologia de Alimentos / Dept. of Food Technology
Universitat de Lleida / University of Lleida (Spain)
         
Tel. +34 973702595
Fax  +34 973702596
IM: Jabber - javier.arantegui (AT) jabberes.org
http://www.tecal.udl.es



reply via email to

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