How to modify the slopes of the sawtooth wave?

조회 수: 11 (최근 30일)
Camille
Camille 2024년 2월 13일
편집: VBBV 2024년 2월 14일
Hi, I generate a sawtooth wave with the following code:
dd = 1;
dtt = 1000;
tt = 0.001:1/dtt:dd;
f = 3; %frequency can be changed
y = sawtooth(2*pi*f*tt,0.75);
I know that the term 0.75 in the sawtooth function allows to change the shape a little bit, when using the value 0.5 instead I get a triangle wave. I want this positive sawtooth wave to be "scalene" and not a 90 degree angle. I want to get a sawtooth wave with a long ascending slope (i.e 30 degrees), and a descending slope of varying steepness as well (i.e. 70 degrees).
I figured there must be a way to solve this manually (i.e. draw the curve by hand and extract the equation, and then program it), but I was wondering if there's a way to do this with already built-in functions in Matlab.
Thank you for your help!
  댓글 수: 1
VBBV
VBBV 2024년 2월 14일
편집: VBBV 2024년 2월 14일
Do you want to obtain sawtooth waveform using the given input function or any function which can generate such pattern using matlab sawtooth ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Les Beckham
Les Beckham 2024년 2월 13일
편집: Les Beckham 2024년 2월 13일
It doesn't really make sense to me to talk about angles when referring to a time history of a signal. If you were to plot the signal versus time, the x axis would be in seconds and the y axis in some other units such as Volts or Amps or pretty much anything else depending on what the signal represents (or dimensionless). How would you define an angle in that situation? Of course, you can resize the plot to make it look like pretty much any angle you want.
dd = 1;
dtt = 1000;
tt = 0.001:1/dtt:dd;
f = 3; %frequency can be changed
y = sawtooth(2*pi*f*tt,0.75);
plot(tt, y)
grid on
figure
plot(tt, y)
ylim([-5 5])
grid on
  댓글 수: 1
VBBV
VBBV 2024년 2월 14일
이동: VBBV 2024년 2월 14일
dd = 3;
dtt = 1000;
tt = 0.001:1/dtt:dd;
f = 3; %frequency can be changed
y = sawtooth(2*pi*f*tt,0.75);
plot(tt,y)
hold on
y = sawtooth(2*pi*f*(tt*f/(4*pi)),0.75);
plot(tt,y); ylim([-2 2])

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by