view dsp/synth/@square/block.m @ 38:9d24b616bb06

Added function algebra.
author samer
date Tue, 29 Jan 2013 15:59:01 +0000
parents c75bb62b90a9
children
line wrap: on
line source
function [y,phi]=block(o,phi,n,duty,f)
% block - generate square wave

t=ceil(1/f);
y=mod(phi+(0:n-1)/t,1)<duty;
phi=mod(phi+n/t,1);