MATLAB-产生扫频非余弦波吗? [英] MATLAB - produce a swept non-cosine wave?
问题描述
我正在尝试产生扫方波或三角波. chirp
函数产生扫余弦波;有没有办法用方波或锯齿波做到这一点?我现在的方法,至少对于像方波这样的方法,是
I am trying to produce a swept square or triangle wave. The chirp
function produces a swept cosine wave; is there a way to do this with the square or sawtooth waves? My approach right now, at least for something like a square wave, is
V = A*chirp(t,f0,t1,f1, 'linear', -90); %#change the cosine wave to a sine wave
V(V<0) = -A;
V(V>0) = A;
我可以用三角波来做相同类型的事情,但这有点烦人.
I can do the same type of thing with a triangle wave, but it's a little more annoying.
一般来说,还有更简单的方法吗?
Generally speaking, is there a more straightforward way?
推荐答案
扫描频率与评估函数相同
The swept-frequency is the same as evaluating a function
function(2 * pi * integral(f(t) dt))
其中f(t)
(随时间变化的频率)与时间成线性关系.
where f(t)
, the time-varying frequency, is linear with time.
只需以两点形式编写一条直线的方程式:
Just write the equation for a line in two-points form:
f(t) = f0 + (t - t0) * (f1 - f0) / (t1 - t0)
并集成:
function(phase0 + 2*pi*f0*t + pi * (t - t0)**2 * (f1 - f0) / (t1 - t0))
最简单的形式是当t0 = f0 = phase0 = 0
时,您将得到:
The simplest form of this is when t0 = f0 = phase0 = 0
, then you get:
function(k * t**2)
这篇关于MATLAB-产生扫频非余弦波吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!