Rectangular Modulation of Noise
Show older comments
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; % Samplefequency in Hz
dt = 1/fs; % Seconds per Sample
duration = 4; % duration in seconds
t = (0:dt:duration-dt);
L = 176400; % Number of samples after 4 seconds for fs=44,1kHz
sigma = 0; % standard deviation
mu = 0;
x = sigma+randn(L,1)+mu; % Gaussian Noise Signal
s = 4*square(2*pi*1*t+1.5); % 1 Hz Rectangular Signal
y = ammod(x,1,fs); % 1 Hz Sine Modulation of Noise x
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
1 Comment
Answers (0)
Categories
Find more on Modulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!