I am trying to generate a pulse of the shape

enter image description here

with the following parameters.

  • Carrier frequency is 5 [GHz]
  • Pulse Repetition Interval is 1600 [ns]
  • Pulse Width is 100 [ns]
  • Rise Time is 8 ns
  • Fall Time is 8 ns Raised
  • Cosine window

How can I generate that pulse?

  • $\begingroup$ Hi Reza- Good to see you again. If it helps you, “raised cosine filters” refer to the frequency shape of the filter as a raised cosine and not the time shape. If that is possibly the issue, I suggest researching raised cosine filters and your question may be more fundamental to that once you have reviewed the descriptions and details that are out there on the internet. $\endgroup$ Feb 17, 2023 at 4:58
  • $\begingroup$ (We don’t typically do code debugging or coding of DSP implementations on this stack exchange site - but if you're able to reframe your question into a signal processing question, if there is one, please do. If it is just how to code Matlab, that typically wouldn’t be answered here. ) $\endgroup$ Feb 17, 2023 at 4:59
  • $\begingroup$ Hello Dan, Ok I removed the code portion. I think what I am really asking is how to generate that pulse shape. If I know the formula I'd be able to implement it myself. $\endgroup$
    – Reza Afra
    Feb 17, 2023 at 5:24
  • $\begingroup$ I do know that raised cosine is for frequency but my problem is forming that shape using the math I found about raised cosine on Wikipedia. $\endgroup$
    – Reza Afra
    Feb 17, 2023 at 5:26
  • 1
    $\begingroup$ Correct Dan, I found out it is something like flattop window. Thanks. $\endgroup$
    – Reza Afra
    Feb 17, 2023 at 5:45

1 Answer 1


So I found out how to generate this wave. It is quite simple actually. One would need to generate a sine wave over a time span and then multiply it by a cosine tapered window (aka Tukey Window). This can be easily accomplished by the following code in python.

import numpy as np
from scipy import signal 

## Generate a window
sample_rate = 400000
time = np.ones(sample_rate)
left = np.zeros(int(sample_rate / 4))
right = np.zeros(int(sample_rate / 4))
middle_window = signal.windows.tukey(int(sample_rate / 2), alpha =0.16)
window = np.hstack((left, middle_window, right))

time = np.linspace(0, 200, sample_rate)
f = 3 / (2*np.pi)
signal = np.sin(2*np.pi*f*time) * window

Which generates the following input signal. enter image description here

  • 1
    $\begingroup$ The question reads 5GHz signal. the time reference of this answer only has 200 samples. f=3 again not what was asked. Anyone can build a 3Hz sin() : the point is to build a 5GHz pulse train modulated with the required pulse repetition. And the question tag is MATLAB , not Python. $\endgroup$ Feb 26, 2023 at 18:24
  • $\begingroup$ @JohnBofarull it looks like there are 400,000 samples, were you reading the horizontal axis as samples instead of ns? $\endgroup$ Mar 24, 2023 at 20:14
  • $\begingroup$ A 5GHz needs at least 10GHz samples, and recommended more than that to avoid pulse start stop uncertainty below 1 cycle. At least 10^10 samples is a lot more than the 4e5 samples generated above. Rewording: at 5GHz carrier, with only 4e5 samples the reels goes empty before the signal reaches the 1st rising slope. $\endgroup$ Apr 5, 2023 at 10:55
  • $\begingroup$ building at least 1 second signal in my opinion is more reliable than just generating 1 single or a few pulses, particularly if the actual signal is a train of pulses, not just 1 isolated pulse. $\endgroup$ Apr 5, 2023 at 11:43
  • $\begingroup$ 4e5 samples is below 5% of a 5GHz 1 second signal sample. And just taking 2 sample per carrier cycle. $\endgroup$ Apr 5, 2023 at 11:45

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