- you're changing the frequency in the signal, like a chirp signal, or
- if you just want to add all those 6 periods together, or
- if you just want to analyze each signal one at a time.
linear swept sine wave
31 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
garima sharma
el 10 de En. de 2021
Comentada: Image Analyst
el 13 de En. de 2021
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.
0 comentarios
Respuesta aceptada
Image Analyst
el 10 de En. de 2021
I'm not sure if
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 comentarios
Image Analyst
el 13 de En. de 2021
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.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!