bugGNU Octave - Bugs: bug #60155, [octave forge] (control) Incorrect...

 
 

bug #60155: [octave forge] (control) Incorrect result on "step()" function when plotting the continuous and discrete step responses

Submitted by:  Henrique José Avelar <hjavelar>
Submitted on:  Tue 02 Mar 2021 12:58:37 PM UTC  
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Ready For Test Assigned to:  Torsten Lilge <ttl>
Originator Name:  Henrique José Avelar Open/Closed:  Open
Release:  5.2.0 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 21 Mar 2021 02:46:12 PM UTC, comment #5: 

Thanks again for testing and the proposed solutions. I have pushed cset https://sourceforge.net/p/octave/control/ci/d46b7954ee4b413bda5d7ceddd9689a0aeac2bca/tree/inst/__time_response__.m?diff=3f51e1bef43cc648b3a55f4c4d6ef570fa3eaece

I have tried to cover more cases including oscillations together with large and small eigenvalues. If the number of samplings N is larger than the maximal value N_MAX, tfinal is only decreased if it was not given by the user. If selected by the user, tfinal is unchanged and dt is increased.

Torsten Lilge <ttl>
Project MemberIn charge of this item.
Sun 14 Mar 2021 11:40:28 AM UTC, comment #4: 

comment #3:

> I saw 2 more problems with the step function. Please try the 2 following test cases.
> sys=tf([0 0 1], [1e-10 1e-8 1]); step(sys); t=0:5e-6:3e-3; hold on; step(sys, t,'r'); axis([0.0015 0.0032 0 2])
> sys=tf([0 0 1], [1e-10 0 1]); step(sys); t=0:5e-6:3e-3; hold on; step(sys, t,'r'); axis([0 0.0035 0 2])
> I append a file in which I implemented a workaround. Maybe this can help you making the final correction.

Thanks for the report and the workaround. I will have a look at this.

comment #3:

> Finally I guess that the new argument "names" is not compatible with the old step function (and other functions calling _time_response_.m).
> Could you also provide these functions?

Ah yes, the new "names" argument was introduced for fixing an issue with the legend. You can download the files which are calling _time_response_.m (step.m, ramp.m, impulse.m, initial.m) from the same location, just replace the file name in the url.

Torsten Lilge <ttl>
Project MemberIn charge of this item.
Sun 14 Mar 2021 10:47:07 AM UTC, comment #3: 

Hi,

I saw 2 more problems with the step function. Please try the 2 following test cases.

sys=tf([0 0 1], [1e-10 1e-8 1]); step(sys); t=0:5e-6:3e-3; hold on; step(sys, t,'r'); axis([0.0015 0.0032 0 2])

sys=tf([0 0 1], [1e-10 0 1]); step(sys); t=0:5e-6:3e-3; hold on; step(sys, t,'r'); axis([0 0.0035 0 2])

I append a file in which I implemented a workaround. Maybe this can help you making the final correction.
Just search for prc_1, prc_2, prc_3 in the file. There is also a prc_4 but this seems to be the problem that you just corrected in your patch.

Finally I guess that the new argument "names" is not compatible with the old step function (and other functions calling _time_response_.m).
Could you also provide these functions?

(file #51058)

Charles Praplan <charprap>
Fri 05 Mar 2021 05:30:44 PM UTC, comment #2: 

This issue is fixed with changeset https://sourceforge.net/p/octave/control/ci/2eab6e137a9c726c61248bf5b409c730e62eab66/
which will be included in the next release of the control package.

For fixing it for you, you can download _time_response_.m here
https://sourceforge.net/p/octave/control/ci/default/tree/inst/__time_response__.m?format=raw
and replace the installed version in the installation folder of the control package with it.

Torsten Lilge <ttl>
Project MemberIn charge of this item.
Tue 02 Mar 2021 10:10:39 PM UTC, comment #1: 

Thanks for the report. This is interesting since the heights of the stairs seems to be okay, but the plotted sampling intervals are too long. If the parameter TFINAL in step() is selected as an integer multiple of the sampling time, all plots do match, weird.

Torsten Lilge <ttl>
Project MemberIn charge of this item.
Tue 02 Mar 2021 12:58:37 PM UTC, original submission:  

% BUG: Incorrect result on "step()" function on the "control" package:
%   when plotting the continuous and discrete step responses,
%   with the 'zoh', both plots need to match in common points
%   but they didn't with some sample periods.
%
% I found the problem in the following commands:
clear all
pkg load control
Gs=tf(1000,[1 20 10000])
figure(1); T=0.063148; Gz=c2d(Gs,T); step(Gs,Gz); %Plots don't match
figure(2); T=0.06314 ; Gz=c2d(Gs,T); step(Gs,Gz); %Plots don't match
figure(3); T=0.0631  ; Gz=c2d(Gs,T); step(Gs,Gz); %Plots don't match
figure(4); T=0.06    ; Gz=c2d(Gs,T); step(Gs,Gz); %Plots match
figure(5); T=0.05    ; Gz=c2d(Gs,T); step(Gs,Gz); %Plots match
%
pause;
%
% Even when the function is ran separately, the incorrect result is founded:
figure(1); hold off; T=0.063148; Gz=c2d(Gs,T);
step(Gs); hold on; step(Gz);  % Plots don't match
figure(2); hold off; T=0.06314 ; Gz=c2d(Gs,T);
step(Gs); hold on; step(Gz);  % Plots don't match
figure(3); hold off; T=0.0631  ; Gz=c2d(Gs,T);
step(Gs); hold on; step(Gz);  % Plots don't match
figure(4); hold off; T=0.06    ; Gz=c2d(Gs,T);
step(Gs); hold on; step(Gz);  % Plots match
figure(5); hold off; T=0.05    ; Gz=c2d(Gs,T);
step(Gs); hold on; step(Gz);  % Plots match
%
% It's also strange that the last plot (no matter how many) uses only one color (blue) and the legend only shows Gz.
% In the previous figures the legend shows Gs (red) and Gz (blue).

Henrique José Avelar <hjavelar>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51058:  __time_response__.m added by charprap (15KiB - text/plain)
file #50969:  bug_in_step_function.m added by hjavelar (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by charprap (Updated the item)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by hjavelar (Submitted the item)
  • -email is unavailable- added by hjavelar
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-03-21 ttl StatusConfirmed => Ready For Test
    2021-03-14 charprap Attached File- => Added __time_response__.m, #51058
    2021-03-02 ttl StatusNone => Confirmed
        Assigned toNone => ttl
        Operating SystemMicrosoft Windows => Any
    2021-03-02 mmuetzel SummaryIncorrect result on "step()" function when plotting the continuous and discrete step responses => [octave forge] (control) Incorrect result on "step()" function when plotting the continuous and discrete step responses
    2021-03-02 hjavelar Attached File- => Added bug_in_step_function.m, #50969
        Carbon-Copy- => Added hjavelar

    Back to the top


    Powered by Savane 3.6