aliasing folding phenomena in frequency domain matlab 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)
Your plot is correct. You are sampling three waves $f_1 = 10\textrm{Hz}, f_2 = 30\textrm{Hz}$, and $f_3 = 70\textrm{Hz}$, with a sample frequency of $F_s = 1.5\times70\textrm{Hz} = 105\textrm{Hz}$. This means that your Nyquist frequency is $F_N = F_s/2 = 52.5\textrm{Hz}$, and corresponds to the maximum value of your frequency axis. 

As such, the signals $f_1$ and $f_2$ will be correctly sampled without problems, but the signal $f_3$ is higher than the Nyquist and so should appear as an alias (folded back into the sampled frequency range) at the frequency $f_{\textrm{alias}} = F_N-(f_3-F_N) = F_s-f_3 = 35\textrm{Hz}$. This is what you obtained.

If you want to create a plot similar to the one in the figure, then you could try to first sample your waves with a much higher sampling rate, in order to fully capture them all faithfully. Then, on the same plot, display what happens if you undersample with $F_N&lt;f_3$.