MATLAB: Error using plot:vectors must be the same length

errorplot

Hello, this is my first time using MATLAB and bumped into Error using plot.
%%simulate noisy signal
Fs = 500;
f = 20;
n = [1/Fs:1/Fs:1];
x = sin(2*pi*f*n) + sin(2*pi*f*n/5);
% add noise to the signal
y = x + rand(1,length(x));
% plot the noisy signal
subplot(2,2,1); plot(n,y);
title('Noisy Signal x(n)');
xlabel('Time (s)');
ylabel('Amplitude');
Wc = 2*pi*f/Fs; % normalized cut-off frequency (as of signal freq)
%%Design Filter and apply on the sequence
% FIR Filter Design
o = 40;
b = fir1(o,Wc); % FIR low pass filter : so that we can use conv()
% filter the signal
x_f_fir = filter(b,1,y);
subplot(2,2,2); plot(n,x_f_fir); title('Denoised noisy signal');
%%Denoise the signal with conv function
conv_fir = conv(b,y);
subplot(2,2,3); plot(n,conv_fir); title('conv() denoised noisy signal')
compiler is complaining that vectors must be the same length.
I have no problem when I comment out the last two codes. But aren't two lines after "%filter the signal" and "%%Denoise the signal with conv function" the same?
Thanks in advance.

Best Answer

Replace line:
plot(n,conv_fir)
with
plot(n,conv_fir(1:length(n)));