Logarithmic amplitude scaling of a signal

20 ビュー (過去 30 日間)
Lorenzo Lellini
Lorenzo Lellini 2023 年 2 月 13 日
回答済み: Jeffrey Clark 2023 年 2 月 14 日
I need to logarithmically scale the amplitude a sinesweep signal from at the starting frequency to at the lastest frequency (it should be 12 dB per octave).
Is this code wrong? Why if I plot the exponential shape and the scaled signal the profiles does not overlap?
duration_sweep = 2; % Seconds
% Sine sweep frequency range
f_start = 100;
f_end = 10000;
% Settings sweeptone
duration_final_silence_sweep = 0.1; % Secondi
total_duration_sweep = duration_sweep + duration_final_silence_sweep ;
sweep = sweeptone(duration_sweep,duration_final_silence_sweep,Fs,"SweepFrequencyRange",[f_start f_end]);
% Time axis
t_input = (0:numel(sweep)-1);
% Scaling factor
amp = logspace(log10(0.1*10^-3), log10(10), length(sweep));
% amplitude scaling
out = sweep.*amp';
% Plot
plot (out, 'LineWidth', 1.5)
hold on
plot(t_input, amp)
grid minor
  3 件のコメント
Lorenzo Lellini
Lorenzo Lellini 2023 年 2 月 13 日
ok, thank you! I forgot to specify Fs but I had already considered it...
How can I perform the procuct between amp and the sweeptone in a correct way since I must specify a silence duration in the sweep and vectors must have the same length?



Jeffrey Clark
Jeffrey Clark 2023 年 2 月 14 日
@Lorenzo Lellini, note that your curve is assuming a full scale sweep of +/- 1 whereas sweeptone produces +/- 0.5 so you need to plot 0.5*amp. And as in my comments above, you need to exclude fix(duration_final_silence_sweep*Fs) bins from the end of sweep.

その他の回答 (0 件)


Help Center および File ExchangeDescriptive Statistics についてさらに検索




Community Treasure Hunt

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

Start Hunting!

Translated by