Code covered by the BSD License  

Highlights from
EC1302 DSP Lab

EC1302 DSP Lab

by

 

These are matlab code for experiments in the course EC1302 DSP Lab.

[t,y]=rect(f,A,D,N)
%[t,y]=rect(f,A,D,N) returns samples for
%                    N cycles of rectangular wave of
%                    time period, T (=1/f) secs, amplitude, A units and
%                    duty cycle, D%
function [t,y]=rect(f,A,D,N)
T=1/f;
P=(D/100)*T;
t1=0:(T/20):P;
t2=P:(T/20):T;
[m1,n1]=size(t1);
[m2,n2]=size(t2);
t=[t1,t2];
y=[A*ones(1,n1),-A*ones(1,n2)];
tapp=[];
yapp=[];
for i=1:N
    tapp=[tapp,t+(i-1)*T];
    yapp=[yapp,y];
end
t=tapp;
y=yapp;
plot(t,y);

Contact us