Sawtooth and square wave generation
조회 수: 6 (최근 30일)
이전 댓글 표시
P = 1e-3;
n = 200;
Ts = P/n;
x = 0:Ts:P-Ts;
f = 1/P;
y = cos(2 * pi * f * x);
y=y*2^7;
y=fix(y);
plot(x,y)
I need to generate waves for a project am doing with VHDL. I used the above code to get the sine wave with 200 points and the period (1e-3). I want to do the same for sawtooth and square waves but not sure what am doing wrong. When i try to edit the above code to fit the sawtooth and square i just get a straight line. What do i change to generate the sawtooth and the square?
Thanks in advance
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 HDL Verifier에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!