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}

  • $\begingroup$ You can very easily write you own function if you wish. And use the vector notation for efficient generation without loops... $\endgroup$
    – Fat32
    Sep 24, 2021 at 10:17

1 Answer 1


It's all about vectorization.

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);
  • $\begingroup$ 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. $\endgroup$
    – Neuling
    Sep 24, 2021 at 11:03
  • $\begingroup$ @Neuling S = sum(A,dim) is exactly the built-in function which meets your demands. What more do you need? $\endgroup$
    – ZR Han
    Sep 24, 2021 at 11:57
  • $\begingroup$ 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 $\endgroup$
    – Neuling
    Sep 24, 2021 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.