the quastion is create a set of K pulses with awidth of Tk where Tk=T/K the signals are shifted from each other by Tk?

1 view (last 30 days)
i want to build agroup of pulses with specific specifications
the quastion is create a set of (K) pulses with a width T=L/k the signals are shifted from each other by T ?

Answers (1)

Vaibhav
Vaibhav on 17 Nov 2023
Hi Mahmood,
I understand that you would like to create a set of "K" pulses with a specific width.
To generate the sequence of pulses, possible workaround is to utilize the "rectpuls" function. This function produces a rectangular pulse with a specified width, centered at time t=0.
The below code snippet creates a series of "K" rectangular pulses one after the other. Each pulse is made using the "rectpuls" function, with a width of "T", and it's placed in time based on its position in the sequence. Afterward, each pulse is plotted separately.
% Parameters
L = 1; % Total duration
K = 5; % Number of pulses
T = L / K; % Width of each pulse
% Time vector
Fs = 1000; % Sampling frequency
t = 0:1/Fs:L;
% Plot each pulse separately
figure;
hold on;
for i = 1:K
plot(t, rectpuls(t - (i-1)*T, T), 'DisplayName', ['Pulse ', num2str(i)]);
end
hold off;
xlabel('Time');
ylabel('Amplitude');
title('Set of Shifted Pulses');
legend('show');
You can refer to the following MathWorks documentation link to know more about "rectpuls" function:
Hope this helps!

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!