I have two vectors. One is of noise and one is of my signal. If I want to add noise vector to signal vector how can i do it. My noise dimension is 41001x1 and my signal is 88200x1.
Here is the code to product a signal and noise of the dimensions you mentioned:
time = (1:88200)';
sig = sin(0.005 * time);
noise = 0.1 * randn(41001, 1);
Since you cannot add two vectors of the same length, I chose to replicate the noise signal by repeating it so that it is the same length as sig
:
multiplier = ceil(length(sig) / length(noise));
noise = repmat(noise, multiplier, 1);
noise = noise(1:length(sig));
Now the noise
and sig
are the same length they can be added and plotted together
plot(time, noise + sig)
In this answer, I'm assuming that noise
and sig
have the same sample rate, but noise
is just too short for some reason. If the noise signal is at a different sample rate, then you would want to use interp1
or resample to get the same sample rate and number of points.