Removing spikes from signal

2 views (last 30 days)
Hasan shovon
Hasan shovon on 12 Apr 2018
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 ??

Answers (0)

Categories

Find more on Electrophysiology 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!