Removing spikes from signal

2 次查看(过去 30 天)
Hasan shovon
Hasan shovon 2018-4-12
Consider the open-loop voltage across the input of an analog instrument in the presence of 60 Hz power-line noise. The sample rate is 1 kHz.
load openloop60hertz
%%code
load openloop60hertz;
fs = 1000;
t = (0:numel(openLoopVoltage) - 1)/fs;
% % Corrupt the signal by adding transients with random signs at random points. Reset the random number generator for reproducibility.
% code
rng default
spikeSignal = zeros(size(openLoopVoltage));
spks = 10:100:1990;
spikeSignal(spks+round(2*randn(size(spks)))) = sign(randn(size(spks)));
noisyLoopVoltage = openLoopVoltage + spikeSignal;
plot(t,noisyLoopVoltage)
xlabel('Time (s)')
ylabel('Voltage (V)')
title('Open-Loop Voltage with Added Spikes')
i have not understand why spikeSignal(spks+round(2*randn(size(spks)))) = sign(randn(size(spks))); is used ??

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Electrophysiology 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by