Broadband signal deesign

11 visualizaciones (últimos 30 días)
John
John el 6 de Ag. de 2011
Respondida: Mathieu NOE el 12 de Feb. de 2023
I'm looking to create a test broadband input signal but am having difficulties.
The signal I'm looking to create is a random phase 10-20Hz signal, Fs=10kHz. I've tried creating a power spectrum centered around the 10-20Hz range but cannot figure out how to correctly go back to the time domain from there.
Does anyone have any ideas on how to go about creating this type of signal?
Thanks, John

Respuestas (1)

Mathieu NOE
Mathieu NOE el 12 de Feb. de 2023
hello
maybe this
you can tune the frequency range , frequency spacing and amplitudes distribution according to your preferences
Fs 10 kHz is quite overkill for such low freq signal
Fs = 1e4;
dt = 1/Fs;
duration = 10; % seconds
t = (0:dt:duration)'; % time vector
freqs = (10:0.5:20); % 21 freqs with 0.5 Hz spacing
amplitudes = ones(size(freqs)); % flat or arbitrary spectral amplitude (up to you)
%% main loop
y = 0;
for ci = 1:numel(freqs)
y = y + amplitudes(ci)*sin(2*pi*freqs(ci)*t+rand*2*pi); % random phase sine
end
% FFT plot
[f1,fft_spectrum1] = do_fft(t,y);
figure(1)
plot(f1,fft_spectrum1,'-*')
xlim([0 50]);
title('FFT Sectrum')
ylabel('|X(f)|')
xlabel('Frequency[hz]')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [freq_vector,fft_spectrum] = do_fft(time,data)
time = time(:);
data = data(:);
dt = mean(diff(time));
Fs = 1/dt;
nfft = length(data); % maximise freq resolution => nfft equals signal length
%% use windowing or not at your conveniance
% no window
fft_spectrum = abs(fft(data))*2/nfft;
% % hanning window
% window = hanning(nfft);
% window = window(:);
% fft_spectrum = abs(fft(data.*window))*4/nfft;
% one sidded fft spectrum % Select first half
if rem(nfft,2) % nfft odd
select = (1:(nfft+1)/2)';
else
select = (1:nfft/2+1)';
end
fft_spectrum = fft_spectrum(select,:);
freq_vector = (select - 1)*Fs/nfft;
end

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by