Mercurial > hg > ishara
annotate dsp/synth/@bpblit/block.m @ 38:9d24b616bb06
Added function algebra.
author | samer |
---|---|
date | Tue, 29 Jan 2013 15:59:01 +0000 |
parents | c75bb62b90a9 |
children |
rev | line source |
---|---|
samer@34 | 1 function [y,phi]=block(o,phi,T,cutoff,f) |
samer@34 | 2 % block - Generate block of bipolar blit signal data |
samer@34 | 3 % |
samer@34 | 4 % block :: |
samer@34 | 5 % bpblit ~'bpblit object' |
samer@34 | 6 % 0--1 ~'initial phase (in cycles)' |
samer@34 | 7 % N:natural ~'number of samples to compute', |
samer@34 | 8 % 0--1 ~'normalised frequency (1=sampling freq)', |
samer@34 | 9 % 0--0.5 ~'cutoff harmonics above this frequency [0.5]', |
samer@34 | 10 % -> [[1,N]] ~'band-limited impulse train', |
samer@34 | 11 % 0--1 ~'initial phase for next block'. |
samer@34 | 12 |
samer@34 | 13 m = max(2,2*floor(cutoff/max(f,eps))); % number of harmonics to keep |
samer@34 | 14 y = m*f*diric(2*pi*(phi+f*(0:T-1)),m); |
samer@34 | 15 phi = mod(phi+f*T,2); |
samer@34 | 16 |