view dsp/synth/expsin.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents c75bb62b90a9
children
line wrap: on
line source
function x=expsin(n,k,l,phi)
% expsin - return real part of complex exponential.
%
% expsin :: 
%    N:natural ~'length of signal to return',
%    real      ~'normalised frequency 1=sample rate',
%    real      ~'decay rate, 1/time constant'
% -> [[N]].
%
% expsin :: 
%    N:natural ~'length of signal to return',
%    real      ~'normalised frequency 1=sample rate',
%    real      ~'decay rate, 1/time constant'
%    real      ~'initial phase'
% -> [[N]].
% 
% If initial phase not given, defaults to -pi/2 (so initial
% value is zero with +ve slope).

if nargin<4, phi=pi/2; end
t=0:n-1;
x=real(exp((2*pi*k*i-l)*t-phi*i));