how to generate below sawtooth pulse

and what is pulse number and how it generates in matlab

1 Comment

Do you have the signal processing toolbox? If so, see sawtooth.
Have you searched the forum for an answer because this question has definitely been addressed.

Sign in to comment.

Answers (2)

DGM
DGM on 17 May 2021
Edited: DGM on 17 May 2021
The super-explicit way:
x = [0 1 1 2 3 3 4 5 5 6 7 7];
y = [0 1 0 0 1 0 0 1 0 0 1 0];
plot(x,y)
You could build those sequences any number of ways. Here's one:
xp = 0:2:7;
x = reshape(xp+[0 1 1].',1,[]);
y = reshape(xp+[0 1 0].',1,[]);
y = mod(y,2);
plot(x,y)
You could also use SPT tools:
x = linspace(0,7,1000);
y = max(sawtooth(pi*(x-1)),0);
plot(x,y)
Another approach using a logical threshold (specific to this waveform) —
t = linspace(0, 7, 500);
s = rem(t,2);
s = s.*(s<1);
figure
plot(t, s, 'LineWidth',2)
grid
axis([0 7.1 0 1.1])
.

8 Comments

what is pulse number i want sir
How do you define or calculate ‘pulse number’?
Pulse number is defined as the number of pulses in the dc
output voltage within one time period of the ac source voltage.
my dc voltage is 2v and ac source is sawtooth pulse .
Pulse number is defined as the number of pulses in the dc
Please define ‘dc’. I doubt it means ‘direct current’ since this is is a pulse train.
It sounds like this has something to do with waveform synthesis (e.g. PWM). If that's the case, this waveform alone can't tell anyone anthing about pulse count. Pulse count would be something you would know only if you knew what the carrier frequency was in relation to the signal frequency. Since no other information is provided, I don't see how this question is answerable.
DGM — I completely agree!
but how to give pulse width and pulse period for above sawtooth signal
Two months!
In this instance, pulse width is one-half the period, and the period is the time between peaks. Several functions, such as findpeaks, islocalmax, islocalmin, and others are useful here.
.

Sign in to comment.

Products

Release

R2020b

Asked:

on 17 May 2021

Commented:

on 19 Jul 2021

Community Treasure Hunt

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

Start Hunting!