Removing spikes from signal
2 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
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!