How to draw a pulse train

26 Ansichten (letzte 30 Tage)
Sadiq Akbar
Sadiq Akbar am 15 Mär. 2022
Kommentiert: Scott MacKenzie am 17 Mär. 2022
I want to draw a pulse train in Matlab like the one shown blue in attached picture. The duration of each pulse is Tp and there are M=199 zeros in between two consective pulses. The PRI of the pulse train is 200Tp. Then I want to decompose each pulse into 7 small pulses of amplitude +1 and -1 (i.e., 1Tp=7Tc where Tc=28ns is the duration of small pulse) like shown white in the attached picture.
  1 Kommentar
Sadiq Akbar
Sadiq Akbar am 16 Mär. 2022
I write a code that draws a square train. The code is as below:
clear all
clc
fy=100;
wy=2*pi*fy;
duy=0.02;
fs=20000;
dt=1/fs;
t=-(duy-dt):dt:(duy-dt);
A=1.5;
y=A*square(wy*t);
plot(t,y,'k')
axis([-duy duy -2.5 2.5])
xlabel('Seconds')
title('Square signal')
Now I want to replace each -ve pulse with M=199 zeros. Can anyboy help me how to do that?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Scott MacKenzie
Scott MacKenzie am 16 Mär. 2022
Bearbeitet: Scott MacKenzie am 17 Mär. 2022
It seems you want to replace the negative portion of the pulse with zeros. Like this, perhaps:
fy=100;
wy=2*pi*fy;
duy=0.02;
fs=20000;
dt=1/fs;
t=-(duy-dt):dt:(duy-dt);
A=1.5;
y=A*square(wy*t);
subplot(1,2,1);
plot(t,y,'k')
axis([-duy duy -2.5 2.5])
xlabel('Seconds')
title('Square signal')
subplot(1,2,2);
y(y<0)=0;
plot(t,y,'k')
axis([-duy duy -2.5 2.5])
xlabel('Seconds')
title('Square signal')
  6 Kommentare
Sadiq Akbar
Sadiq Akbar am 17 Mär. 2022
ok Scott MacKenzie thank you very much. At least you tried your best to help me out. So thank you very much for your try and your good step for my help.
Scott MacKenzie
Scott MacKenzie am 17 Mär. 2022
You're welcome. Good luck.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by