How the rectangular pulse will be after subtraction A minus B ??

3 visualizzazioni (ultimi 30 giorni)

Risposte (1)

Moksh
Moksh il 31 Ott 2023
Hi Tariq,
I understand that you are trying to generate two rectangular pulses "∏(t-2)" and "∏((t-1)/3)" and then plot their difference.
You can try generating a time series and then use logical indexing to generate square pulse. Then their difference can be plotted using the “plot” function in MATLAB.
Here is an example code for this:
% Generate a time vector
t = 0:0.01:10;
% Generate the square pulse (t-2)
A = (t >= 2) & (t < 3);
% Generate the square pulse (t-1)/3
B = (t >= 1/3) & (t < 2/3);
% Combine the two square pulses
resultant_pulse = A - B;
% Plot the combined pulse
figure;
plot(t, resultant_pulse);
xlabel('t');
ylabel('Amplitude');
title('A - B');
For more information about the “plot” function please refer to the following link:
I hope this information helps resolve the query.
Best Regards,
Moksh Aggarwal

Community Treasure Hunt

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

Start Hunting!

Translated by