# Sum of complex exponential signal in MATLAB

I want to create a sum of damped complex exponential signal with the known values of frequency $$f$$, damping $$\alpha$$, amplitude $$a$$ and phase $$\phi$$ for the $$k = 1,2,...,K$$ exponentials. Is there already a command in MATLAB that does it? P.S. I have already written own function to do this.

$$\begin{equation} x_n = \sum_{k=1}^{K} (a_k e^{j\phi_k})(e^{\{(- \alpha_k + j2\pi f_k )\Delta t\}n}) + b_n, \quad n = 0,1,...,N-1 \end{equation}$$

• You can very easily write you own function if you wish. And use the vector notation for efficient generation without loops... Sep 24 at 10:17

N = 8;
K = 10;
k = 1:K;            % row vector
f = k * 100;        % row vector
alpha = k / 10;     % row vector
a = k / 10;         % row vector
phi = k * pi;       % row vector

deltat = 1;

n = (0:N-1)';       % column vector
b = (1:N)';         % column vector

x = sum(a.*exp(1j*phi).*exp((-alpha+1j*2*pi*f)*deltat.*n)+b, 2);

• Thank you. Yes, I have this function written already, but I wanted to know whether there is any inbuilt function in MATLAB toolbox to do this. Sep 24 at 11:03
• @Neuling S = sum(A,dim) is exactly the built-in function which meets your demands. What more do you need? Sep 24 at 11:57
• I was looking for functions like chirp, sin, sawtooth etc, to generate signal for sum of exponentials. But I realized it is not available. Thank you for your support Sep 24 at 12:08