Excel如何設(shè)置動(dòng)態(tài)求和 Excel設(shè)置動(dòng)態(tài)求和方法
1410
2025-03-31
sawtooth 函數(shù)
x?=?sawtooth(t)?generates a?sawtooth?wave with period 2π?for the elements of the time array?t.?sawtooth?is similar to the sine function but creates a?sawtooth?wave with peaks of –1 and 1. The?sawtooth?wave is defined to be –1 at multiples of 2π?and to increase linearly with time with a slope of 1/π?at all other times.
x?=?sawtooth(t,xmax)?generates a modified triangle wave with the maximum location at each period controlled by?xmax.
上面兩種形式是MATLAB官方的幫助文檔給出的,但這并不是我今天想呈現(xiàn)給大家的,我想通過基本的解釋,之后通過案例的對(duì)比來感受這個(gè)函數(shù)。更多的是體會(huì)參數(shù)xmax的含義。
x?=?sawtooth(t,xmax)?,t是時(shí)間陣列,也就是時(shí)間軸;xmax這個(gè)參數(shù)的含義是這個(gè)鋸齒波的峰值位置位于哪里,沒有這個(gè)參數(shù)的話,其實(shí)默認(rèn)為1,此時(shí),峰值位于最右側(cè);如果設(shè)置為0,則峰值在左側(cè);可想而知,如果為0.5,則峰值位于中間。
x?=?sawtooth(t) 生成一個(gè)周期為2π的鋸齒波,類似于正弦波,只不過波形不一樣而已。
如果想了解更多,在MATLAB的命令框里輸入doc sawtooth,回車即可。
下面給出對(duì)比案例:
產(chǎn)生一個(gè)10個(gè)周期的鋸齒波,其基波周期為50Hz,采樣率為1kHz。
%Generate 10 periods of a sawtooth wave with a fundamental frequency of 50 Hz. The sample rate is 1 kHz.
clear
clc
close all
T = 10*(1/50);
Fs = 1000;
dt = 1/Fs;
t = 0:dt:T-dt;
x = sawtooth(2*pi*50*t);
plot(t,x)
title('50 Hz sawtooth waveform');
xlabel('t\s');
ylabel('amplitude');
grid on
將 sawtooth 函數(shù)改為:
x = sawtooth(2*pi*50*t, 0.5);
繼續(xù)運(yùn)行得到如下波形:(可見得到一個(gè)三角波)
將 sawtooth 函數(shù)改為:
x = sawtooth(2*pi*50*t, 0);
繼續(xù)運(yùn)行得到如下波形:
MATLAB
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請(qǐng)聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請(qǐng)聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。