Chirp generation

조회 수: 3 (최근 30일)
Bogie
Bogie 2012년 1월 11일
I would like to creat a customized chirp sequence where frequency is changing every half cycle and I do not know how to go about it.
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 1월 11일
I do not see how the result could have the necessary properties to be called a "chirp" ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Dr. Seis
Dr. Seis 2012년 1월 11일
As Walter says, this will not give you a true chirp signal. If you are aware of this and would still like to have a pseudo-chirp then you can take a look at the example below. I show the difference between trying to generate the type of chirp you are after and a real chirp signal. I also plot the derivative of the resulting signals, so I can highlight that between half cycles you will have a sometimes subtle (sometimes not so subtle) jump in gradient.
df = 0.1; % define frequency increment
f = 0.1 : df : 1; % define frequencies for "chip" signal
dt = 0.1; % define a dt for final timeseries
% Generate 1Hz cosine wave
nt = 0 : 1/360 : 1-1/360;
a = 1;
s = a*cosd(0 : 1 : 359);
% Initialize x & y
x = zeros(1,179*numel(f)+1);
y = a*ones(1,179*numel(f)+1);
end_time = 0;
for i = 1 : numel(f)
x((1:179) + (i-1)*179 + 1) = nt(2:180)/f(i) + end_time;
if mod(i,2) ~= 0
y((1:179) + (i-1)*179 + 1) = s(2:180);
else
y((1:179) + (i-1)*179 + 1) = s(182:360);
end
end_time = nt(180)/f(i) + end_time;
end
% x is irregular spacing
% we need to interpolate to a regular spacing
x_new = 0 : dt : x(end);
y_new = interp1(x,y,x_new,'spline')
y_chirp = chirp(x_new,f(1),x_new(end),f(end));
% Determine derivative/differential info
x_diff = x_new(2:end-1);
y_diff = arrayfun(@(n)(y_new(n+1)-y_new(n-1))/(2*dt),2:numel(x_new)-1);
y_cdiff = arrayfun(@(n)(y_chirp(n+1)-y_chirp(n-1))/(2*dt),2:numel(x_new)-1);
% plot results
figure;
subplot(2,1,1)
plot(x_new,y_new); hold on;
plot(x_new,y_chirp,'r-'); hold off;
legend('pseudo-chirp','real chirp');
subplot(2,1,2);
plot(x_diff,y_diff); hold on;
plot(x_diff,y_cdiff,'r-'); hold off;
legend('pseudo-chirp','real chirp');

카테고리

Help CenterFile Exchange에서 Waveform Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by