Quantcast

impulse() giving error

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

impulse() giving error

Huub van Niekerk
Hi,

I have a question on impulse(). When I do this in Matlab, I get a good
response. In Octave-3.2.3 (Mac) I get this:

octave-3.2.3:1> H=tf([2 1],[4 3]);
octave-3.2.3:2> impulse(H)
warning: meaning may have changed due to change in precedence for && and
|| operators
error: impulse: D matrix is nonzero, impulse response infinite.
error: called from:
error:   /Users/huub/octave/control-1.0.10/__stepimp__.m at line 203,
column 7
error:   /Users/huub/octave/control-1.0.10/impulse.m at line 69, column 9
octave-3.2.3:2>

Is this an Matlab-incompatibility or a bug?

Thanks

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Huub van Niekerk
On 4/2/10 9:50 AM, Huub wrote:

> Hi,
>
> I have a question on impulse(). When I do this in Matlab, I get a good
> response. In Octave-3.2.3 (Mac) I get this:
>
> octave-3.2.3:1>  H=tf([2 1],[4 3]);
> octave-3.2.3:2>  impulse(H)
> warning: meaning may have changed due to change in precedence for&&  and
> || operators
> error: impulse: D matrix is nonzero, impulse response infinite.
> error: called from:
> error:   /Users/huub/octave/control-1.0.10/__stepimp__.m at line 203,
> column 7
> error:   /Users/huub/octave/control-1.0.10/impulse.m at line 69, column 9
> octave-3.2.3:2>
>
> Is this an Matlab-incompatibility or a bug?
>
> Thanks

Update: just updated to control-1.0.11, but error remains.

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Doug Stewart-4
In reply to this post by Huub van Niekerk
Try doing the inverse Laplace transform of your function.

If you can't do it or find the answer then maybe Octave can't either!

I know that I can't do it.
Doug Stewart


On Fri, Apr 2, 2010 at 3:50 AM, Huub <[hidden email]> wrote:
Hi,

I have a question on impulse(). When I do this in Matlab, I get a good
response. In Octave-3.2.3 (Mac) I get this:

octave-3.2.3:1> H=tf([2 1],[4 3]);
octave-3.2.3:2> impulse(H)
warning: meaning may have changed due to change in precedence for && and
|| operators
error: impulse: D matrix is nonzero, impulse response infinite.
error: called from:
error:   /Users/huub/octave/control-1.0.10/__stepimp__.m at line 203,
column 7
error:   /Users/huub/octave/control-1.0.10/impulse.m at line 69, column 9
octave-3.2.3:2>

Is this an Matlab-incompatibility or a bug?

Thanks

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave


_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Lukas Reichlin-3
In reply to this post by Huub van Niekerk
Hi

The problem is that your transfer function is proper, but not strictly proper. You can do a polynomial division as below:

H(s) = (2s + 1) / (4s + 3) * 1
where 1 denotes the Laplace transform of the Dirac function d(t).

H(s) = 0.5 + (-0.5) / (4s + 3) = 0.5 - 0.125 / (s + 0.75)
Now it's obvious that this response has a non-zero feedthrough: 0.5
The inverse Laplace transformation is a piece of cake:

h(t) = 0.5*d(t) - 0.125*exp(-0.75*t)

Matlab's impulse response lacks the first term, i.e. it doesn't show the Dirac. Check
H = tf (1)
impulse (H)
if you don't believe that Matlab is wrong :-) To make it short, the reason is that Matlab doesn't build the inverse Laplace transform but calculates the response in discrete-time state-space.

hope this helps
Lukas

PS: I wrote a new control package which copies the behaviour of Matlab. Have a look at
http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/control.tar.gz?view=tar
if you're interested. You can install the package in the usual way.

Warning: Because of a bug in Octave 3.2.x, system sys changes sampling time after the first call of a time response function (lsim, step, impulse, initial). This bug is fixed in current development sources (>= 3.3.51) for Octave 3.4.

> Hi,
>
> I have a question on impulse(). When I do this in Matlab, I get a good
> response. In Octave-3.2.3 (Mac) I get this:
>
> octave-3.2.3:1> H=tf([2 1],[4 3]);
> octave-3.2.3:2> impulse(H)
> warning: meaning may have changed due to change in precedence for && and
> || operators
> error: impulse: D matrix is nonzero, impulse response infinite.
> error: called from:
> error:   /Users/huub/octave/control-1.0.10/__stepimp__.m at line 203,
> column 7
> error:   /Users/huub/octave/control-1.0.10/impulse.m at line 69, column 9
> octave-3.2.3:2>
>
> Is this an Matlab-incompatibility or a bug?
>
> Thanks
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave


_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Huub van Niekerk
Can I install it next to control-1.0.11 or do I have to uninstall that
first?

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Lukas Reichlin-3
> Can I install it next to control-1.0.11 or do I have to uninstall that
> first?

It is not possible to have both of them installed/loaded. If you install my package (it becomes control-2.0 upon release of Octave 3.4), Octave will remove control-1.0.11 automatically.

Regards
Lukas
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Huub van Niekerk

> It is not possible to have both of them installed/loaded. If you install my package (it becomes control-2.0 upon release of Octave 3.4), Octave will remove control-1.0.11 automatically.
>
> Regards
> Lukas

It looks like there's some kind of error in the package:

octave-3.2.3:5> pkg install control.tar.gz
/var/folders/sS/sSh5rQruH4SgrVy6x4vesU+++TI/-Tmp-//ccOogLBg.s:2139:indirect
jmp without `*'
/var/folders/sS/sSh5rQruH4SgrVy6x4vesU+++TI/-Tmp-//ccOogLBg.s:2154:indirect
jmp without `*'
/var/folders/sS/sSh5rQruH4SgrVy6x4vesU+++TI/-Tmp-//ccOogLBg.s:2169:indirect
jmp without `*'
/var/folders/sS/sSh5rQruH4SgrVy6x4vesU+++TI/-Tmp-//ccOogLBg.s:2184:indirect
jmp without `*'

This goes on and on....

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Lukas Reichlin-3

On 03.04.2010, at 12:23, Huub wrote:

>
>> It is not possible to have both of them installed/loaded. If you install my package (it becomes control-2.0 upon release of Octave 3.4), Octave will remove control-1.0.11 automatically.
>>
>> Regards
>> Lukas
>
> It looks like there's some kind of error in the package:
>
> octave-3.2.3:5> pkg install control.tar.gz
> /var/folders/sS/sSh5rQruH4SgrVy6x4vesU+++TI/-Tmp-//ccOogLBg.s:2139:indirect
> jmp without `*'
> /var/folders/sS/sSh5rQruH4SgrVy6x4vesU+++TI/-Tmp-//ccOogLBg.s:2154:indirect
> jmp without `*'
> /var/folders/sS/sSh5rQruH4SgrVy6x4vesU+++TI/-Tmp-//ccOogLBg.s:2169:indirect
> jmp without `*'
> /var/folders/sS/sSh5rQruH4SgrVy6x4vesU+++TI/-Tmp-//ccOogLBg.s:2184:indirect
> jmp without `*'
>
> This goes on and on....

Let me guess: You are using Octave.app with g95 on MacOSX 10.6. These warnings are due to an outdated version of the g95 Fortran compiler included with Octave.app. You can safely ignore them. The package should install correctly anyway. Note that installation may take up to several minutes (for compiling the Fortran files). You can verify installation afterwards by running some tests: try some of these

test ltimodels
test h2syn
test hinfsyn
test lyap
test care
...



_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Huub van Niekerk

>
> Let me guess: You are using Octave.app with g95 on MacOSX 10.6.

MaxOSC 10.5 actually.

>These warnings are due to an outdated version of the g95 Fortran compiler included with Octave.app. You can safely ignore them. The package should install correctly anyway. Note that installation may take up to several minutes (for compiling the Fortran files). You can verify installation afterwards by running some tests: try some of these
>
> test ltimodels
> test h2syn
> test hinfsyn
> test lyap
> test care
> ...

Yup, did well:

octave-3.2.3:6> test ltimodels
PASSES 19 out of 19 tests
octave-3.2.3:7> test h2syn
PASSES 2 out of 2 tests
octave-3.2.3:8> test hinfsyn
PASSES 2 out of 2 tests
octave-3.2.3:9> test lyap
PASSES 3 out of 3 tests
octave-3.2.3:10> test care
PASSES 6 out of 6 tests

and:

octave-3.2.3:11> H=tf([2 1],[4 3])

Transfer function "H" from input "u1" to output ...
       2 s + 1
  y1:  -------
       4 s + 3


impulse(H) gives a nice graph now.

step(H) goes wrong now, though:

octave-3.2.3:13> step(H)
error: A(I): Index exceeds matrix dimension.
error: called from:
error:
/Applications/Octave.app/Contents/Resources/share/octave/3.2.3/m/plot/stairs.m
at line 131, column 8
error:
/Applications/Octave.app/Contents/Resources/share/octave/3.2.3/m/plot/stairs.m
at line 72, column 2
error:   /Users/huub/octave/control-0.3.0/__timeresp__.m at line 180,
column 13
error:   /Users/huub/octave/control-0.3.0/step.m at line 36, column 14

With control-1.0.11, it gave a good response.

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Lukas Reichlin-3
> octave-3.2.3:11> H=tf([2 1],[4 3])
>
> Transfer function "H" from input "u1" to output ...
>       2 s + 1
>  y1:  -------
>       4 s + 3
>
>
> impulse(H) gives a nice graph now.
>
> step(H) goes wrong now, though:


I warned you in my first mail ;-)
> Warning: Because of a bug in Octave 3.2.x, system sys changes sampling time after the first call of a time response function (lsim, step, impulse, initial). This bug is fixed in current development sources (>= 3.3.51) for Octave 3.4.

You can try step first and impulse afterwards. You will see that now step works correctly and impulse fails.

You can check this by

H = tf ([2, 1], [4, 3])
step (H)
H

and you get

octave-3.2.3:2> H = tf ([2, 1], [4, 3])

Transfer function "H" from input "u1" to output ...
      2 s + 1
 y1:  -------
      4 s + 3

octave-3.2.3:3> step (H)
octave-3.2.3:4> H

Transfer function "H" from input "u1" to output ...
      2 s + 1
 y1:  -------
      4 s + 3

Sampling time: 0.14 s
octave-3.2.3:5>

The last line shows that the model has a sampling time of 0.14 seconds. This bug is the reason why I didn't publish control-2.0 so far.


_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: impulse() giving error

Huub van Niekerk

> The last line shows that the model has a sampling time of 0.14 seconds. This bug is the reason why I didn't publish control-2.0 so far.

Ok, I understand. I will use Matlab then, until the bug was fixed.

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Loading...