linear swept sine wave

조회 수: 31 (최근 30일)
garima sharma
garima sharma 2021년 1월 10일
댓글: Image Analyst 2021년 1월 13일
Hi,
I am trying to obtain the frequency response of a linear swept sine wave using Matlab. I have constant amplitude 1V sine signal from 0.5Hz to 30 Hz with a sampling of 1024Hz. Here frequency is increasing with a step of 0.5Hz and each frequency has 6cycle.
I am using Matlab to take the Fourier transform of the recorded signal. I am trying to plot this function from frequency 0.5Hz to 30 Hzbut FFT appears to noise only.
Could anybody tell me how to take FFT of linear swept sine wave?
I would be grateful for any hint on this.
Thanks in advance.

채택된 답변

Image Analyst
Image Analyst 2021년 1월 10일
I'm not sure if
  1. you're changing the frequency in the signal, like a chirp signal, or
  2. if you just want to add all those 6 periods together, or
  3. if you just want to analyze each signal one at a time.
Which case is it? But here is a start:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format short g;
format compact;
fprintf('Beginning to run %s.m ...\n', mfilename);
% I have constant amplitude 1V sine signal from 5 Hz to 30 Hz
% with a sampling of 1024Hz. Here frequency is increasing with
% a step of 0.5 Hz and each frequency has 6 cycles.
% Make x axis:
dt = 1/1024;
% Longest period is for 5 Hz (.2 seconds)
% so 6 cycles would be 6 * 0.2 = 1.2 seconds.
x = 0 : dt : 1.2;
omega = 5 : 30
for k = 1 : length(omega)
thisOmega = omega(k);
thisPeriod = 1 / thisOmega;
fprintf('Omega = %.1f. Period = %.4f\n', thisOmega, thisPeriod);
% Determine where 6 cycles end
lastIndex = find(x <= 6 * thisPeriod, 1, 'last'); % For you to figure out.
thisx = x(1 : lastIndex);
y = sin(2 * pi * thisOmega * thisx);
plot(thisx, y, '-');
legendStrings{k} = sprintf('Omega = %.1f', thisOmega);
hold on;
drawnow;
end
grid on;
legend(legendStrings);
fontSize = 20
title('6 periods of several frequencies', 'FontSize', fontSize);
ylabel('Amplitude', 'FontSize', fontSize);
xlabel('Time in Seconds', 'FontSize', fontSize);
g = gcf;
g.WindowState = 'maximized';
fprintf('Done running %s.m.\n', mfilename);
  댓글 수: 6
garima sharma
garima sharma 2021년 1월 13일
yes but its not working,
even i cut every 6 cycle data and find fft for each freq. now, problem is how to merge data since each fft has different resolution.
Image Analyst
Image Analyst 2021년 1월 13일
If you want the same resolution for all of them, then just zero out the time domain signal wherever you don't want it to get just those signal. But of course you'll get the fft of the signal (which is a delta function) convolved with a sinc function since you're cropping it with a rect function. So the overall fft signal will be a sinc function, with a phase shift of course.
There should be no problem with all of them together - you should basically get separated spikes - one for each frequency. Not sure why you wanted to concatenate them, then separate them again anyway.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by