function [ x, fs ] = generate1(N,m,A3)
f1 = 100;
f2 = 200;
T = 1./f1;
t = (0:(N*T/m):(N*T))'; %'
wn = randn(length(t),1); %zero mean variance 1
x = 20.*sin(2.*pi.*f1.*t) + 30.*cos(2.*pi.*f2.*t) + A3.*wn;
%[pks,locs] = findpeaks(x);
%plot(x);
fs = 1/(t(2)-t(1));
end
and see
absfft = abs(fft(y));
plot(fs/2*linspace(0,1,length(absfft)/2+1),2*absfft(1:end/2+1))
or
plot(linspace(-fs/2,fs/2,length(absfft)),fftshift(absfft))
the x-axis in your plot is from 0 to fs/2 and then from -fs/2 to 0