Professional Documents
Culture Documents
t=0:0.01:5;
x=10*exp(-t)-5*exp(-0.5*t);
plot(t,x);
title('continuous time signal ')
xlabel('t')
ylabel('x(t)')
%%
hold on
x=10*exp(-t)+5*exp(-0.5*t);
plot(t,x);
title('continuous time signal ')
xlabel('t')
ylabel('x(t)')
hold off
%%
t=linspace(-0.002,0.002);
a1=250;
a2=500;
a3=750;
a4=100;
y1=20*sin(2*pi*1000*t-pi/3).*exp(-a1.*t);
y2=20*sin(2*pi*1000*t-pi/3).*exp(-a2.*t);
y3=20*sin(2*pi*1000*t-pi/3).*exp(-a3.*t);
y4=20*sin(2*pi*1000*t-pi/3).*exp(-a4.*t);
subplot(2,2,1);
plot(t,y1);
title('sinusoidal signal')
xlabel('t')
ylabel('y(t)')
subplot(2,2,2);
plot(t,y2);
title('sinusoidal signal')
xlabel('t')
ylabel('y(t)')
subplot(2,2,3);
plot(t,y3);
title('sinusoidal signal')
xlabel('t')
ylabel('y(t)')
subplot(2,2,4);
plot(t,y4);
title('sinusoidal signal')
xlabel('t')
ylabel('y(t)')
%%
Magnitude_x1 = abs(x1);
subplot(2,1,1)
stem(k,Magnitude_x1)
Phase_x1 = angle(x1);
subplot(2,1,2)
stem(k,Phase_x1
function y=impulseDT(n)
y = (n == 0);
ss = find(round(n) == n);
if(~isempty(ss))
n(ss) = NaN;
end
end
%%
function y = unitDT(n)
y = (n >= 0);
ss = find(round(n) == n);
if(~isempty(ss))
n(ss) = NaN;
end
end
%%
function y = rampDT(n)
y = n.*pos;
ss = find(round(n) ~= n);
if (~isempty(ss))
y(ss)=NaN;
end
end
%%
n = -10 : 1 : 10;
s1n = impulseDT(n-3);
subplot(6,3,1);
stem(n,s1n);
subplot(6,3,2);
stem(n,s2n);
subplot(6,3,3);
stem(n,s3n);
subplot(6,3,4);
stem(n,s4n);
subplot(6,3,5);
stem(n,s5n);
subplot(6,3,6);
stem(n,s6n);
%%
x1n = exp(-2*n).*(unitDT(n)-unitDT(n-4));
x1n_sq = x1n.*x1n;
Ex = sum(x1n_sq);
x2n = exp(-1*n).*(unitDT(n)-unitDT(n-4));
x2n_sq = x2n.*x2n;
Ex = sum(x2n_sq);
%%
x3n = cos(pi*n/3).*(unitDT(n)-unitDT(n-4));
x3n_sq = x3t.*x3n;
Ex = sum(x3t_sq);
Px = Ex/length(t); % Power
x4n = ((-1)^n)/3).*unitDT(n);
x4n_sq = x4n.*x4n;
Ex = sum(x4n_sq);
Px = Ex/length(n); % Power
%%
n = -12 : 12;
gn= (abs(1i/4)^n).*unitDT(n);
figure('even')