Rectangular Modulation of Noise

조회 수: 8 (최근 30일)
sonicycle
sonicycle 2019년 6월 24일
편집: sonicycle 2019년 7월 4일
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
sonicycle
sonicycle 2019년 7월 4일
편집: sonicycle 2019년 7월 4일
Alright, solved the problem in the following way:
fs = 44100; % Sample fequency in Hz
L = 176400; % Number of samples after 4 seconds for fs=44,1kHz
sigma = 0; % standard derviation
mu = 0;
fmod = 4; % Modulation frequency
cycles = L/fs*fmod;
x = sigma+randn(L,1)+mu; % Gaussian Noise Signal
for j = 1:cycles
x(fs*1/fmod*j-(fs*1/(2*fmod)):fs*1/fmod*j)=0;
end
A for-loop now mutes the noise-signal in periodic intervals. The modulation frequency fmod and the sample frequency fs can be determined freely.
Looks like this now (e.g. 4 Hz modulated):
Kind Regards :)
sonicycle

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Modulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by