MATLAB: Plot error variables not same length

plot

I'm highly suspicious that the error has to do with line 26, "f = fs*(0:Nsamps/2-1)/Nsamps; " The error I get when I run the program below is:
"Error using plot Vectors must be the same length. Error in CleanAdaptFiltered (line 31) plot(f, y_fft);"
f is a row 1×2000 Nsamps size? I'm not sure of. Something to with the lengthe of t? t is row 1×4001. I've changed too Nsamps = length(ich) and changing line 26 too, "f = fs(1/(dt*Nsamps)*(0:Nsamps));" and "f = 1/(dt*Nsamps)*(0:Nsamps);", same problem.
load AdaptiveFilteredData
d = AdaptiveFilteredData;
fs =100;
dt = .001;
t = 0:dt:4.0001;
%ich = AdaptiveFilteredData.ichannel;
%qch = AdaptiveFilteredData.qchannel;
%plot(ich,qch);
%%PLOTS
%plot(t,ich);
%plot(t,qch);
figure;
plot(t,ich)
xlabel('time(s)');
ylabel('Amplitude');
grid on
Nsamps = length(t); % Window length
y_fft = abs(fft(ich)); %Retain Magnitude
f = fs*(0:Nsamps/2-1)/Nsamps; %Prepare freq data for plot
figure;
plot(f, y_fft); % FFT plot
xlim([0 1]);
xlabel('Frequency(Hz)');
ylabel('FFT Magnitude');
grid on

Best Answer

try this if could resolve the problem. I have selected those elemnts of "y_fft" corresponding to "f" vector.
plot(f, y_fft(1:length(f))); % FFT plot