How to apply one signal's envelope to another signal?

10 views (last 30 days)
I extract a signal's envelope (Figure 1) and I am trying to apply onto another signal but the modulated output signal (Figure 2) looks really weird. Figure 3 is the signal that I want to modulate, i.e. the one that I want to apply extracted envelope. Here is the snippet of the code:
figure(4)
[env_upper,env_lower] = envelope(env_window)
plot(t_window , env_window) % Plot the entire signal
hold on
plot(t_window, env_upper, t_window, env_lower) % Overlay the envelope on the above plot. Use line spec to change the line colors
hold off
title('Envelope of Referred Signal from Phantom Head')
xlabel ('Time,s');
ylabel ('Voltage, V');
%possible idea
%B_extract = B(30:90)
%Modulate Signal B with A ie. B_extract+A.*B_extract (Amplitude modulation)
load('Test_Sham_Alpha.mat');
EEG.Data = scalingFactor*EEG.Data;
am_mod = envelope(env_window) + y_to_be_modified.*envelope(env_window);
EEG.Data(1,15001:45000) = am_mod;
figure (5)
plot(EEG.Time(1,1:46600) , EEG.Data(1,1:46600))
title('Amplitude Modulated EEG+tACS Signal')
xlabel ('Time,s');
ylabel ('Voltage, V');
Anyone knows how to fix so I the output would be a proper amplitude modulated signal? Thanks in advance.

Answers (0)

Community Treasure Hunt

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

Start Hunting!