Whenever the special variable
end_time is non-zero, wasora enters into transient mode. These examples introduce transient problems by illustrating how first-order lags can be used to filter signals.
This example generates a signal r(t) which is zero except for a < t < b, where it takes the value one. Then, the signal y(t) is computed as a first-order lag of r(t) with a characteristic time \tau. The output consists of three columns containing t, r(t) and y(t). By using the keyword
HEADER a commented line is pre-prended to the output with a textual representation of the expressions passed to
# this is a transient problem and lasts 5 units of time end_time = 5 # each time step is equal to 1/20th of a unit of time dt = 1/20 # some parameters, which we define as constants CONST a b tau a = 1 b = 3 tau = 1.234 # signal r is equal to zero except for a < t < b r = 0 r[a:b] = 1 # signal y is equal to signal r fitered through a lag # of characteristic time tau y = lag(r, tau) PRINT t r y # exercise: investigate how the result of the lag # depends on the time step
Instead of writing the long input shown in
lag.was, we could have obtained the same result with a couple of lines. Indeed, the terminal shows that the output of this input is the same as the one of the previous longer example.
The reported difference is due to the presence of the
HEADER keyword in the first input so qdp can automatically label the bullets. kate
Not only does this example illustrate the usage of a first-order lag, but also of a point-wise defined function s(t) (more on one-dimensional functions in case 007-functions). In this case, the data is interpolated using the Akima method, and
end_time is set to the variable
s_b which contains the last value of the one-dimensional function
s_a contains the first value).