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]=sqr(f,A,N)
%[t,y]=sqr(f,A,N) returns samples for 
%                 N cycles of square wave of 
%                 time period, T (=1/f) secs and amplitude, A units
function [t,y]=sqr(f,A,N)
T=1/f;
t1=0:(T/20):(T/2);
t2=(T/2):(T/20):T;
t=[t1,t2];
[m1,n1]=size(t1);
[m2,n2]=size(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