Hi everyone,
I'd like to generate a white gaussian noise signal which is modulated by a square signal. I thought the simplest way is just by multiplying in the time domain, but an Error comes out saying "Out of memory" which I can understand because my noise signal is a one column array and the rectangular function is a huge matrix. I think I need to unify both...
However, I thought there might be a modulation-function which can be used for any signal like the ammod(x,f,fs) function from the Communications Toolbox (which is a sine modulation). Is there any chance for a rectangular modulation function?
This is my code:
close all
clear all
fs = 44100;
dt = 1/fs;
duration = 4;
t = (0:dt:duration-dt);
L = 176400;
sigma = 0;
mu = 0;
x = sigma+randn(L,1)+mu;
s = 4*square(2*pi*1*t+1.5);
y = ammod(x,1,fs);
figure(1);
subplot(2,1,1);
plot(t,x,t,s);
axis([0 duration -5 5]);
title('White Noise and 1 Hz Rectangular Function');
xlabel('Seconds');
ylabel('Sample Values');
grid on;
subplot(2,1,2);
plot(t,y);
axis([0 duration -5 5]);
title('White Noise 1 Hz Sine Modulated');
xlabel('Seconds');
ylabel('Sample Values');
grid on;
What I am trying to achieve is a noise signal modulated by a square wave with modulation depth of 100% and a duty cycle of 50% like the red function in the upper plot. Thank you so much, I appreciate any help!
Greetings