I'm including here my original Matlab code but I think it is clear enough for non-Matlab users to understand what the lines are doing. I have tested this on Python also and had the same results. What I have done is basically add up three sinusoids of distinctive frequencies but equal amplitudes and then I decomposed the combined signal to observe the power spectrum peaks. The problem is, depending on the number of sample points and the sampling frequency, the peak sizes take different ratios relative to each other instead of being of equal sizes because the component signals have the same amplitude. If we consider FFT as some form of dot product then why doing dot product manually (between the signal and the sine wave) gives the correct result but FFT is dependent on the number of samples and the sampling frequency? Thank you.
fs = 10;
time = 0:1/fs:205; % in seconds
freqs = [0.05, 0.1, 0.3]; % Hz
signal = zeros(1, length(time));
for f_i = 1:length(freqs)
signal = signal + sin(2*pi*freqs(f_i)*time);
end
power_spectrum = abs(fft(signal)).^2 % Of course I'm just skipping the trimming part here
plot(power_spectrum)
You can check the adjusted plot here: spectrum