如何用MATLAB画周期函数?

如题所述

其实matlab里面有直接定义三角波的函数的
就是sawtooth(t,width)其用法跟sin(t)差不多.
比方说你的条件是x=1-abs(t)(-2<t<2)
下面是代码:
clearall
clc
t=-4:0.01:4;
f=sawtooth(1/2*pi*(t+2),0.5);
plot(t,f);
gridon;
最后附上一些函数吧
特殊函数
boxcar()矩形窗
triang()三角窗
tripuls()非周期三角脉冲
sawtooth()锯齿波
rectpuls()非周期矩形脉冲
square()方波
sinc()sinc函数
diric()冲击函数
温馨提示:答案为网友推荐,仅供参考