필터 지우기
필터 지우기

How to find a single period from a graph?

조회 수: 2 (최근 30일)
Yasmine Sellwood
Yasmine Sellwood 2020년 8월 20일
편집: Utkarsh Belwal 2020년 8월 24일
Can somone please help me? I've produced the code below and I now need to find a single period from Signal 3 and plot it on a new graph with an appropriate time vector, tPeriod and save it to a new variable additive_noise.
Thank you very much for your time :)
%% 1.0 Plot the received speech singal
T = 5; %period
sample = 44100*20; % samples
period = 4; %required number of periods
SinglePeriod = linspace (0, T, 44100*5 + 1); %single period
SinglePeriod(end) = []; %time vetor
t = linspace(0, T*period, sample+1); %time vector required
t(end) = [];
noiseSound = repmat(noiseSound, 1, period);
plot(t, noiseSound, 'b');
title('Received speech signal')
xlabel('Time (s)')
ylabel('Amplitude')
filtered = zeros(size(noiseSound));
%% 1.1 Identifying the two interfering waveforms
s1 = (SinglePeriod/A); %signal one
Signal1 = repmat(s1, 1, period);
figure
subplot(3,1,1)
plot(t, Signal1, 'b')
title('Signal 1')
xlabel('Time (s)')
ylabel('Amplitude')
hold on
s2 = exp(-(SinglePeriod-B)/4); %signal 2
Signal2 = repmat(s2, 1, period);
subplot(3,1,2)
plot(t, Signal2, 'g')
title('Signal 2')
xlabel('Time (s)')
ylabel('Amplitude')
s3 = zeros(1, period);
s3(SinglePeriod >= 0 & SinglePeriod < 2.5) = ((A*SinglePeriod(SinglePeriod >= 0 & SinglePeriod < 2.5))/4);
s3(SinglePeriod >= 2.5 & SinglePeriod < 5) = (((-A*SinglePeriod(SinglePeriod >= 2.5 & SinglePeriod < 5))+(5*A))/4);
Signal3 = repmat(s3, [1 period]); %signal 3
subplot(3,1,3)
plot(t, Signal3, 'r')
title('Signal 3')
xlabel('Time (s)')
ylabel('Amplitude')
hold off
%% 2.0 Generate the noise waveforms - a single period
additive_noise_first =
  댓글 수: 1
Utkarsh Belwal
Utkarsh Belwal 2020년 8월 24일
편집: Utkarsh Belwal 2020년 8월 24일
Can you define the variables noiseSound and A as without defining them code will give an error.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by