Pad ratio
Pad ratio
Why? To improve frequency resolution
Make complex signal with long and short bursts of power at 8 and 45 Hz
%-----------------------------------------------------------------------------------
% Make complex signal with long and short bursts of power at 8 and 45 Hz
%-----------------------------------------------------------------------------------
D = 2; %signal duration 2s
S = 1000; % sampling rate, i.e. N points pt sec used to represent sine wave
F = [8 8 45 45]; % 4 frequencies in Hz
w = 2*pi*F; % convert frequencies to radians
P = [0 0 0 0]; % 4 corresponding phases
T = 1/S; % sampling period, i.e. for this e.g. points at 1 ms intervals
t = [T:T:D]; % time vector %corrected from previous version
t=t(1:length(t)-1); % takes off extra point arising from starting at zero
nfreqs=length(F); % N frequencies in the complex
A=ones(nfreqs,length(t)); %amplitudes initialised at one
A(1,550:570)=3; %burst of increased amplitude at each time pt
A(2,700:900)=3;
A(3,950:970)=3;
A(4,1100:1300)=3;
% Add all sine waves together to give composite
for thispt=1:2000
for thisfreq=1:nfreqs
mysig(thisfreq,thispt) =A(thisfreq,thispt)*sin(w(thisfreq)*t(thispt));
end
end
mysig2=sum(mysig,1);
t=t-.5; %subtract 500 ms to indicate baseline is negative
figure; plot(t,mysig2);
xlabel('Time (seconds)');
ylabel('Amplitude');
scrsz = get(0,'ScreenSize');
Testing different pad ratio and save plots
Last updated





