How to reconstruct a periodic signal as a sum of cosine functions from the freq. spectrum in MATLAB

Поделиться
HTML-код
  • Опубликовано: 28 окт 2024

Комментарии • 5

  • @MathiasMagdowski
    @MathiasMagdowski  2 года назад +1

    Unfortunately, I found a bug in the code of my example provided at:
    octave-online.net/bucket~EP15mJvkgLCmzodFStNw3b
    This code will only work, if the DC part is zero or quite small. If it is not, it must be devided by a factor of 2 when reconstructing the function.
    On solution to fix the problem is to replace the lines:
    % reconstructed signal (in N) -> vector
    F_x_t_reconstructed=F_x_t_reconstructed+amplitude(n_harmonic)*cos(omega*t+phase_angle(n_harmonic));
    with
    % reconstructed signal (in N) -> vector
    if frequency(n_harmonic)==0
    F_x_t_reconstructed=F_x_t_reconstructed+amplitude(n_harmonic)/2;
    else
    F_x_t_reconstructed=F_x_t_reconstructed+amplitude(n_harmonic)*cos(omega*t+phase_angle(n_harmonic));
    end

  • @bilalbadar7310
    @bilalbadar7310 3 года назад +2

    a good explanation for the reconstruction of a signal, it's completely solved my problem.

  • @mohammaddaliri7713
    @mohammaddaliri7713 Год назад +1

    Thank you very much, quite useful.