Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Questions about Matlab code for sampling and aliasing

Status
Not open for further replies.

leony

Member level 1
Joined
Feb 28, 2005
Messages
41
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,615
I am new to matlab and I was trying to code a sampling and aliasing example. But I have a few questions:

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...
 

Re: matlab help please

you have already implented an aliasing example. now you are sampling every 10th zero crossing of the sinusoid signal. for instance set interval now to 950 and you will see a sinus with a frequency of 50.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top