生成三角波的函數




摘要:這個程序可以生成確定長度確定周期的三角波

程序:

function [ts,y]=triangle(t,p);
% triangle wave generation
% t is the range of time and has the size 1x2
% p is the period of triangle wave
% Example:
% [ts,y]=triangle([0,20],2);plot(ts,y)
% \copyright: zjliu
% Author's email: zjliu2001@163.com
ts=t(1):p/20:t(2);
y=asin(abs(sin(ts*pi/p)))/pi*2;


感謝蘿卜網友
登錄后免費查看全文
立即登錄
App下載
技術鄰APP
工程師必備
  • 項目客服
  • 培訓客服
  • 平臺客服

TOP

1