# bug #46597: [octave forge] (control) version 3.0.0 impulse function yields incorrect result

 Submitted by: None Submitted on: Thu 03 Dec 2015 11:52:28 AM UTC Category: Octave Forge Package Severity: 3 - Normal Priority: 5 - Normal Item Group: Regression Status: Fixed Assigned to: None Originator Name: Pablo Fernández Originator Email: -email is unavailable- Open/Closed: Closed Release: 4.0.0 Operating System: Any

You are not logged in

## Discussion

Wed 07 Mar 2018 08:39:27 PM UTC, comment #6:

FTR, Doug has provided the "impulse invariant" option to c2d (if I take it right).

Olaf Till <i7tiol>
Mon 05 Mar 2018 07:42:44 PM UTC, comment #5:

This can be closed.
Control-3.1.0 has the fix.

Doug Stewart <dastew>
Wed 23 Mar 2016 02:46:13 AM UTC, comment #4:

I want to document where I have arrived at.

In   _impulse_response_
at line 333 we have:

x = B * u; # B, not G!

If we replace the B with G  opposite to the comment,
then the final values of the impulse response are correct.
And the error reported here is fixed.
I then did more testing to make sure that nothing else broke,
and found that the initial values were wrong! They seemed to
be the values for the second numbers of the sequence, not time 0 values.
After studying the code and trying different ways to get values for time=0
I came to the conclusion that the code is giving me
a value (wrong value) for time zero.

The real problem is in the convertion from Laplce space to Z space.
This is done with the c2d command. But the conversion is using the
"ZOH" method. The "ZOH" methode of conversion from Laplace to "Z" space
gives accurate results for a "step" input but not for an "impulse" input.
Therefore to get the proper impulse responce we must add a "Impulse invarient"
option to the c2d function in the control pkg. (matlab has this option)

I have never figued out this convertion, and would ask you the reader
If you know the exact method to let me know or implement it your self
in the c2d function.

Until this is done I think we should do the change on line 333.
(this must be done either way)
This will give us a much closer curve.

Doug Stewart

Doug Stewart <dastew>
Tue 26 Jan 2016 12:47:15 AM UTC, comment #3:

I looked at this again and now my test_control is stable and does not crash octave

I also see that the impulse(1/s) is returning .1 instead of 1
I did some single stepping through the code but have not got it figured out yet.

Doug Stewart <dastew>
Thu 03 Dec 2015 04:28:24 PM UTC, comment #2:

Marking as confirmed and adding package maintainer in cc.

Mike Miller <mtmiller>
Thu 03 Dec 2015 04:06:41 PM UTC, comment #1:

I can confirm that control 3.0.0 has problems.
test_control crashes octave to a frozen state and I get different error messages depending on what I did before I ran test_control.

Doug Stewart

Anonymous
Thu 03 Dec 2015 11:52:28 AM UTC, original submission:

I think impulse yields and incorrect result in control 3.0.0.

For example, if I do, in my box

>> s = tf("s");
>> G = 1/(s+1);
>> R = 1/s;
>> y = impulse(R);

y returns an array of  0.1
where it should be an array of 1

Also, impulse(R*G) should return the same plot as step(G) but it doesn't. For example:

>> y = impulse(R*G);
>> y(end)

ans =  10.438

But it should be 1.

I have compared with http://octave-online.net/ featuring
Octave 3.8.2 with control 2.6.6 (according to the ver command) where results are correct.

Thanks

Anonymous

## Attached Files

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Comment:

No files currently attached

## Dependencies

Depends on the following items: None found

Items that depend on this one

Digest:
bug dependencies.

Carbon-Copy List
• -email is unavailable- added by i7tiol (Posted a comment)
• -email is unavailable- added by jwe (Updated the item)
• -email is unavailable- added by dastew (Posted a comment)
• -email is unavailable- added by mtmiller (Posted a comment)
• -email is unavailable- added by mtmiller
• -email is unavailable- added by None (Submitted the item)
•

Do you think this task is very important?
This task has 0 encouragements so far.

Only project members can vote.

## History

Date Changed by Updated Field Previous Value => Replaced by
2018-03-07 i7tiol StatusConfirmed Fixed
Open/ClosedOpen Closed
2017-08-13 jwe Summarycontrol package 3.0.0: impulse function yields incorrect result [octave forge] (control) version 3.0.0 impulse function yields incorrect result
2016-06-05 mtmiller Operating SystemGNU/Linux Any
Summarycontrol 3.0.0. Impulse yields incorrect result control package 3.0.0: impulse function yields incorrect result
2016-06-05 mtmiller Dependencies- bugs #48138 is dependent
2016-03-10 mtmiller Dependencies- bugs #47384 is dependent
2015-12-03 mtmiller Item GroupIncorrect Result Regression
StatusNone Confirmed