leony
Member level 1
I am new to matlab and I was trying to code a sampling and aliasing example. But I have a few questions:
In this code when phi=0, the sinusoid clips. Why is that happening? And how can I show an aliasing example due to undersampling? The last question, how can I clip the sinusoid, lets say -/+0.5
Thanks...
Code:
clc;
clear all;
%A is the amplitude
A=1;
%f is the frequency(Hz)
f=100;
T=1/f;
%fs is the sampling frequency
fs=1000;
%phi is the arbitraty phase,
phi = 2*pi*0.75;
tstart=0;
tstop=5*T;%5 Cycles
interval=1/fs;%time interval
t =tstart:interval:tstop;
%the sinusoid
S=A*sin(2*pi*f*t+phi);
In this code when phi=0, the sinusoid clips. Why is that happening? And how can I show an aliasing example due to undersampling? The last question, how can I clip the sinusoid, lets say -/+0.5
Thanks...