Signal Matlab Incompatibility

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Signal Matlab Incompatibility

Thomas D. Dean-2
Octave 4.3.0+
Signal 1.3.2

The matlab square function takes a duty cycle argument as a percentage,
0..100.

The signal package duty cycle argument is a decimal, 0..1

Tom Dean

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Signal Matlab Incompatibility

Juan Pablo Carbajal-2
> The matlab square function takes a duty cycle argument as a percentage,
> 0..100.
> The signal package duty cycle argument is a decimal, 0..1
Thanks for spotting this, would you open a ticket in the bug tracker.
This is a matlab incompatibility quite easy to fix (fell free to
upload a patch).

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Signal Matlab Incompatibility

Thomas D. Dean-2
On 08/05/2017 01:24 PM, Juan Pablo Carbajal wrote:
>> The matlab square function takes a duty cycle argument as a percentage,
>> 0..100.
>> The signal package duty cycle argument is a decimal, 0..1
> Thanks for spotting this, would you open a ticket in the bug tracker.
> This is a matlab incompatibility quite easy to fix (fell free to
> upload a patch).
>

Done

This change will effect all previous uses of square.m!  But, it becomes
compatible with Matlab.

Tom Dean

 > diff square.m.orig square.m
9,10c9,10
< ## If @var{duty} is specified, the square wave is +1 for that portion
of the
< ## time.
---
 > ## If @var{duty} is specified, it is the percentage of time the square
 > ## wave is "on".  The square wave is +1 for that portion of the time.
13c13
< ##                     on time
---
 > ##                   on time * 100
21c21
< function v = square (t, duty = 0.5)
---
 > function v = square (t, duty = 50)
29c29
<   v(t-floor(t) >= duty) = -1;
---
 >   v(t-floor(t) >= duty/100) = -1;

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Loading...