I am calculating Time period of Sine/Cos Wave with different frequencies while keeping the Sampling Frequency at 1MHz and plotting it, but in some cases the value of time period is too big,
have a look at some of the examples.
n=[0:0.1:10] %because Time period is 10 F1=100*10^3; %100KHz and t=1*10^-5 Fs=1*10^6; %1MHz => Sampling Frequency T=1/Fs; %1*10^-6 %Time period = t/T => 10 xn=cos(2*pi*(F1)*n*T) %T=1/Fs stem(n,xn); ylim([-1.5 1.5]); xlim ([0 10]); %because Time period is 10 grid on;
Here Time period = 10 which means one oscillation would take 10seconds to complete. and here is the output as i expected,
Similarly in second case when i changed the frequency to 10Hz while the Sampling frequency remains 1MHz the value of Time period is way too big,
n=[0:1000:100*10^3] %because Time period is 100*10^3 F1=10; %10Hz and t=0.1 Fs=1*10^6 %1MHz T=1/Fs; %1*10^-6 %Time period = t/T => 100*10^3 xn=sin(2*pi*(F1)*n*T) stem(n,xn) ylim([-1.5 1.5]) xlim ([0 100*10^3]) %because Time period is 100*10^3 ylim ([-1 1]) grid on
and the output wave is,
is it the correct value or am i doing some sort mistakes calculating the time period ?