help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Signal Matlab Incompatibility


From: Thomas D. Dean
Subject: Re: Signal Matlab Incompatibility
Date: Sat, 5 Aug 2017 19:05:23 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]