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 次查看(过去 30 天)
显示 更早的评论
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 ?
0 个评论
回答(1 个)
Vaibhav
2023-11-17
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!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!