# Generate a pulse with Tukey window [closed]

I am trying to generate a pulse of the shape

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?

• 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. Feb 17, 2023 at 4:58
• (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. ) Feb 17, 2023 at 4:59
• 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. Feb 17, 2023 at 5:24
• 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. Feb 17, 2023 at 5:26
• Correct Dan, I found out it is something like flattop window. Thanks. Feb 17, 2023 at 5:45

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.

• 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. Feb 26, 2023 at 18:24
• @JohnBofarull it looks like there are 400,000 samples, were you reading the horizontal axis as samples instead of ns? Mar 24, 2023 at 20:14
• 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. Apr 5, 2023 at 10:55
• 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. Apr 5, 2023 at 11:43
• 4e5 samples is below 5% of a 5GHz 1 second signal sample. And just taking 2 sample per carrier cycle. Apr 5, 2023 at 11:45