0
$\begingroup$

I'm confused as what is the difference between these two sine wave equations

x(t) = Sin(2*pi*F*t)

and

x(t) = Sin(2*pi*F*nTs)

x(t) = Sin(2*pi*F*t) is supposed to be used with analog signal, here t is supposed to me the samples when speaking of matlab.

A = 4;       %Amplitude
Freq = 100;
Time = 1/Freq; %0.01
Fs = 1000;      %Sampling Frequency 
Ts = 1/Fs;   %Sampling Rate 
t = 0:Ts:(Time); 
x=A*sin(2*pi*Freq*t);

The output,

enter image description here

Similarly if I use the stem command than a plot command I will get the sampled values instead.

enter image description here

If I'm getting the sampled result from the first equation than what is the purpose to replace t by nTs in the equation and using the second equation ?

I couldn't be able to demonstrate the difference and visualize it in Matlab. Kindly guide me.

$\endgroup$
5
$\begingroup$

The first equation:

x(t) = Sin(2*pi*F*t)

is for a continuous ("analogue") signal, where t may take any real value.

The second equation:

x(t) = Sin(2*pi*F*n*Ts)

(I assume that this is the correct version - it looks like you have a typo in the question ?)

is for a discrete ("sampled" or "digital") signal, where n is the sample number (integer) and Ts is the sample interval (inverse of sample rate). It has values only at the discrete sampling points where t = n * Ts.

In your MATLAB code you are effectively sampling a continuous function, so although you start off with the first (continuous) equation you end up with the second equation because you are only evaluating (sampling) the continuous function at a set of discrete points.

Note also that as Ts -> 0 the discrete version tends towards the continuous version.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.