Azzera filtri
Azzera filtri

How to find a single period from a graph?

2 visualizzazioni (ultimi 30 giorni)
Yasmine Sellwood
Yasmine Sellwood il 20 Ago 2020
Modificato: Utkarsh Belwal il 24 Ago 2020
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 Commento
Utkarsh Belwal
Utkarsh Belwal il 24 Ago 2020
Modificato: Utkarsh Belwal il 24 Ago 2020
Can you define the variables noiseSound and A as without defining them code will give an error.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by