Hello i am trying to create the folding phenomena of undersampling in matlab, When i undersample the sampling frequency is 135 less than the Nyquist frequency for 70 Hz signal ou will see that it is shifted back by the amount of this new sampling frequency (105-70=35) Hz. as shown in the matlab plot bellow. I want to create the folding effect shown in diagram bellow (shifted copy). Where did i go wrong. This is my code which producedthe plot in the first post. my code is shown as one line for some reason.
f1=10; f2=30; f3=70; % twice the sampling rate Fs=1.5*70; % sampling frequency is a bit above 2 times to get all the peaks. Ts=1/Fs; Tn=0:Ts:1; fft_L=length(Tn); y4_samples=10*sin(2*pi*f1*Tn)+10*sin(2*pi*f2*Tn)+10*sin(2*pi*f3*Tn); %stem(Tn_new,y4_samples); ff=fft(y4_samples); ff1 = abs(ff/fft_L); fft2 = ff1(1:floor(fft_L/2)+1); fft2(2:end) = 2*fft2(2:end); f = Fs*(0:fft_L/2)/fft_L; plot(f, fft2)