Confusion with Nyquist theorem when sampling cosines versus sines

I'm having different results when sampling a cosine wave versus sine wave at different scenarios. I used MATLAB to plot waveforms.

I will try to give some examples to make clear where I'm stuck at.

Figure 1 below shows a 10Hz cosine wave(top) and a 90Hz cosine wave(bottom blue) both sampled at 100Hz sampling rate. Black dots show the sampled resulting waveform. As we can see the 90Hz cosine is aliased as 10Hz:

Figure 1:

Now we change the waveform to sine, and Figure 2 below shows a 10Hz sine wave(top) and a 90Hz sine wave(bottom blue) both sampled at 100Hz sampling rate. Again the black dots show the sampled resulting waveform. As we can see the 90Hz sine is aliased as 10Hz. But this time there is 180° shift:

Figure 2:

In similar fashion, Figure 3 below shows a 10Hz cosine wave(top) and this time a 50Hz cosine wave(bottom blue) both sampled at 100Hz sampling rate. As we can see since we are sampling with twice the waveform frequency(2×50Hz), the bottom cosine wave is reconstructed without any aliasing:

Figure 3:

But now we do the same thing for a sine wave. Now Figure 4 below shows a 10Hz sine wave(top) and 50Hz sine wave(bottom blue) both sampled at 100Hz sampling rate. And again we are sampling with twice the waveform frequency(2×50Hz). But the 50Hz waveform is not reconstructed as in cosine case, the sampled waveform has disappeared:

Figure 4:

Regarding the above observations, I'm confused at three points:

1-) Regarding Figure 1 and Figure 2, what is the real signal here? Cosine or sine? Aliased cosine does not have 180° shift but the aliased sine has. What is the significance/meaning of this difference?

2-) Regarding Figure 3 and Figure 4, I thought Nyquist theorem applies any cosine or sine. But in Figure 4 what is going on? The sine disappears even though it is sampled at Nyquist rate.

3-) I cannot make sense of these observations. It is because when we apply sinusoidal waveform to a scope from a function generator, the scope or ADC does not know whether the input signal is cosine or sine. Yet sine behaves differently than cosine when sampled as in my question. What can be the cause for the confusion here?

• For the 50hz sine, aren't you sampling at the zero crossing point each time? – BeB00 Sep 19 '18 at 18:44
• I dont know but according to the theorem as long as the sampling rate is twice this shouldn't happen. Do you mean this is related to MATLAB? – panic attack Sep 19 '18 at 18:46
• As long as the sampling rate is more than twice the signal frequency, this won't happen.The Nyquist limit is not an inclusive limit, for exactly the reason you've demonstrated. – The Photon Sep 19 '18 at 18:52
• dsp.stackexchange.com/a/14134 – BeB00 Sep 19 '18 at 18:54
• With only 2 samples per cycle, there is up to 100% amplitude error as seen in your figure 4. Technically the signal is not aliased, but 2 points per cycle is not sufficient to reconstruct the waveform without much error. Even figure 3 which reconstructed the amplitude, does not capture the phase. Can't see if its phase is 0 or 180 degrees. As a rule of thumb, use at least 10 samples per cycle for adequate signal integrity. – MarkU Sep 19 '18 at 21:35