Logarithmic amplitude scaling of a signal
이전 댓글 표시
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
figure(1)
plot (out, 'LineWidth', 1.5)
hold on
plot(t_input, amp)
grid minor

댓글 수: 3
Jeffrey Clark
2023년 2월 13일
Jeffrey Clark
2023년 2월 13일
@Lorenzo Lellini, you are also using the length of sweep four your amp but sweep includes the silence duration as indicated in sweeptone documentation.
Lorenzo Lellini
2023년 2월 13일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Measurements and Spatial Audio에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!