从MATLAB帮助文档上学习 chirp

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Reborn_Lee/article/details/82874232

当我直接去看chirp的MATLAB帮助文档时,始终不得要领,查看了很多博文上的说法,也还是不懂,直到我去查看了维基百科,并总结了下面这篇博文后,反过来看chirp的MATLAB帮助文档,才觉得明朗了一些。

【 MATLAB 】适合初学者的 chirp 理解与推导

因此,推荐看看上篇这篇博文,先从基础上了解下chirp信号。


MATLAB 中称 chirp 为 Swept-frequency cosine,也即扫频余弦波。

MATLAB 中给出了 chirp 如下的语法结构:

下面一一简单介绍:

y = chirp(t,f0,t1,f1) 在阵列t中定义的时间实例中产生线性扫频余弦信号的样本,f0为时间为0时刻的瞬时频率,f1为时刻t1时的瞬时频率,二者单位都是赫兹。如果未指定,则对于logarithmic chirp,f0为10^-6;对于其他的chirp,f0都为0,t1为1,f1为100.

 

y = chirp(t,f0,t1,f1,'method') 指定可选择的扫频方法,扫频方法介绍如下:

如果看了上篇博文,这点介绍应该是能看懂的(尽管有些差异,差异在于叫法以及少了下面的第二种情况),我就不翻译了,翻译也许就没那么精妙了。

总结起来,扫频方法分为三种,分别为linear、quadratic、logarithmic。

y = chirp(t,f0,t1,f1,'method',phi) allows an initial phase phi to be specified in degrees. If unspecified, phi is 0. Default values are substituted for empty or omitted trailing input arguments.

这种形式指定了初始相位,如果未指定初始相位为0。

y = chirp(t,f0,t1,f1,'quadratic',phi,'shape') specifies the shape of the quadratic swept-frequency signal's spectrogram. shape is either concave or convex, which describes the shape of the parabola in the positive frequency axis. If shape is omitted, the default is convex for downsweep (f0 > f1) and is concave for upsweep (f0 < f1).

y = chirp(t,f0,t1,f1,'quadratic',phi,'shape')指定二次扫频信号的频谱图的形状。 形状是凹形或凸形,它描述了正频率轴上抛物线的形状。 如果省略形状,则默认为下扫频(f0> f1)为凸,而上扫频(f0 <f1)为凹。


下面举一个例子:

Linear chirp

Generate a chirp with linear instantaneous frequency deviation. The chirp is sampled at 1 kHz for 2 seconds. The instantaneous frequency is 0 at t = 0 and crosses 250 Hz at t = 1 second.

产生具有线性瞬时频率偏差的chirp。采样率为1KHz,时间为2s,初始频率为0,时间为1时刻的频率为250Hz。

% Generate a chirp with linear instantaneous frequency deviation. 
% The chirp is sampled at 1 kHz for 2 seconds. 
% The instantaneous frequency is 0 at t = 0 and crosses 250 Hz at t = 1 second.

clc
clear
close all


t = 0:1/1e3:2;
y = chirp(t,0,1,250);
subplot(2,1,1)
plot(t,y)
subplot(2,1,2)
spectrogram(y,256,250,256,1e3,'yaxis')


Quadratic chirp

Generate a chirp with quadratic instantaneous frequency deviation. The chirp is sampled at 1 kHz for 2 seconds. The instantaneous frequency is 100 Hz at t = 0 and crosses 200 Hz at t = 1 second.

% Generate a chirp with quadratic instantaneous frequency deviation. 
% The chirp is sampled at 1 kHz for 2 seconds. 
% The instantaneous frequency is 100 Hz at t = 0 and crosses 200 Hz at t = 1 second.

clc
clear
close all


t = 0:1/1e3:2;
y = chirp(t,100,1,200,'quadratic ');
subplot(2,1,1)
plot(t,y)


% Compute and plot the spectrogram of the chirp.
% Specify 128 DFT points, a Hamming window of the same length, and 120 samples of overlap.

subplot(2,1,2)
spectrogram(y,256,250,256,1e3,'yaxis')

 


中间流了两种情况,等我弄明白了再填。

那个spectrogram我会单独写一篇博客,弄懂它。暂时还不是太明白原理。


Logarithmic Chirp

% Generate a logarithmic chirp sampled at 1 kHz for 10 seconds. 
% The instantaneous frequency is 10 Hz initially and 400 Hz at the end.



clc
clear
close all


t = 0:1/1e3:10;
fo = 10;
f1 = 400;
y = chirp(t,fo,10,f1,'logarithmic');
subplot(2,1,1)
plot(t,y)

% Compute and plot the spectrogram of the chirp.
% Specify 256 DFT points, a Hamming window of the same length, and 200 samples of overlap.

subplot(2,1,2)
spectrogram(y,256,200,256,1e3,'yaxis')

 

展开阅读全文

没有更多推荐了,返回首页