Professional Documents
Culture Documents
Lab 03: Signals and Sequences: 3.1) Generating Sinusoidal Waveforms
Lab 03: Signals and Sequences: 3.1) Generating Sinusoidal Waveforms
Lab 03: Signals and Sequences: 3.1) Generating Sinusoidal Waveforms
W0 = 10.8 % rad/sec
t = -0.5:0.01:0.5;
f = 3.17*cos( W0*t+pi/6);
figure(1)
plot (t,f)
grid
%Debug->save and run
W0 = 10.8 % rad/sec
t = -0.5:0.01:0.5;
f = 3.17*exp(1.3*t).*cos( W0*t+pi/6); % the dot (.)is an scalar which
produces an element by element multiplication
figure(2)
plot (t,f)
grid
%Debug->save and run
Page 1
Signals and Systems Lab DEE,FURC
n = -10:1:10
f = 10*(-0.9).^n
figure (3)
stem (n,f)
%for discrete time we use the term 'stem' to view the graph
%whereas for continuous time we used the term'plot'.
grid
xlabel ('sample,n')
ylabel('f(n)')
title('alternatring discrete exponential sequence')
axis([-10,10,-30,30])
text(0,6,'f(n)=10(-0.9).^n')
%Debug->save and run
Page 2
Signals and Systems Lab DEE,FURC
n = -10:1:10
s= stepfun(n,0)
figure(4)
stem(n,s)
grid
%Debug->save and run
f1=f.*s
figure(5)
stem(n,f1)
grid
%Debug->save and run
Page 3
Signals and Systems Lab DEE,FURC
echo off
close all
clear all
% x(t) = (6-t^2)/(2+t^2)
T = 0.001 %sampling time in sec
N = 1024 %number of samples
t = -3*N*T:T:3*N*T %to generate the time axis
x = (6-t.^2)./(2+t.^2);
%if we don't use the dot (.), the terms will consider as matrixes.
figure(1)
plot(t,x)
grid
xlabel('time,seconds')
ylabel('amplitude')
title('x(t) = (6-t^2)/(2+t^2)')
Page 4
Signals and Systems Lab DEE,FURC
x1 = (6-4*t.^2)./(2+4*t.^2);
figure(2)
plot(t,x1)
grid
x2 = (6-(t/4).^2)./(2+(t/4).^2);
figure(3)
plot(t,x2)
grid
Page 5
Signals and Systems Lab DEE,FURC
%500*T=0.5
t = -5*N*T:T:5*N*T %changing the time axis to have the whole figure
x = (6-(t-500*T).^2)./(2+(t-500*T).^2);
figure(4)
plot(t,x)
grid
%time-reversal
t = -5*N*T:T:5*N*T
x5 = t.^3;
x6=(-t).^3;
figure(5);
subplot(2,1,1); plot(t,x5); axis([-3,3,-20,20]); grid;
subplot(2,1,2); plot(t,x6); axis([-3,3,-20,20]); grid;
Page 6
Signals and Systems Lab DEE,FURC
load handel
Fs =8192
%sound(y,Fs)
Ts=1/Fs;
t1 = -36556*Ts:Ts:36556*Ts
figure(6)
plot(t1,y)
y1=flipud(y)
%sound(y1)
%we need to make the previous sound command to be a command->
%sound(y,Fs)
figure(7)
plot(t1,y1)
grid
%down sampling
m=2
Page 7
Signals and Systems Lab DEE,FURC
%up sampling
Page 8