how do i plot a sawtooth graph without using the sawtooth function?

조회 수: 32 (최근 30일)
indiphile mnge
indiphile mnge 2019년 5월 6일
답변: Matthias SImons 2021년 4월 21일
T = 10*(1/50);
Fs = 1000;
dt = 1/Fs;
t = 0:dt:T-dt;
x = sawtooth(2*pi*50*t);
plot(t,x)
grid on

답변 (3개)

Raj
Raj 2019년 5월 6일
See the accepted answer here:
You have to define a high value for parameter 'n' in the code.

Vedika Shinde
Vedika Shinde 2021년 1월 27일
i) Write a set of MATLAB commands for approximating the continuous-time periodic Sawtooth wave of amplitude 5 volts, fundamental frequency 20Hz,and duty cycle 0.5. Plot five cycles of this waveform. ii) Find out the fourier series of this waveform plotted in (i). (iii) Plot the equation of Fourier series to get the original waveform back.

Matthias SImons
Matthias SImons 2021년 4월 21일
I stumbled over this question and generated an own solution:
To generate a sawtooth with time period T, over a time signal t just use interp1:
xx = [0 T/2 T];
yy = [1 0 1];
y = interp1(xx, yy, mod(t, T));

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by