cs-1 Complete
cs-1 Complete
cs-1 Complete
unitstep = (t>=0);
figure()
hvs = heaviside(t);
plot(t,unitstep,t,hvs,'--','LineWidth',3)
title('Unit step signal')
xlabel("time")
ylabel("f(t)")
legend('self-made','heaviside')
ylim([-1.5 1.5]);
%Impulse Signal
t1=-3:0.01:3;
impulse = (t1==0);
figure()
plot(t1,impulse)
title('Impulse')
xlabel("time")
ylabel("f(t)")
ramp = t.*unitstep;
figure()
plot(t,ramp)
ylim([-1 1.5]);
title('Unit ramp')
xlabel("time")
ylabel("f(t)")
w = 6;
a = 2;
a0 = -2;
syms x
figure()
fplot(sin(x),[-2*pi 2*pi])
grid on
title('Sinusoidal signal (sin)')
xlabel("time")
ylabel("sin(t)")
syms x
figure()
fplot(cos(x),[-2*pi 2*pi])
grid on
title('Sinusoidal signal (cos)')
xlabel("time")
ylabel("cos(t)")
syms x
figure()
fplot(tan(x),[-pi pi])
grid on
title('Sinusoidal signal (tan)')
xlabel("time")
ylabel("tan(t)")
%Exponential Signal
e = exp(a*t);
figure()
plot(t,e)
xlabel("time")
ylabel('e^t')
title("exponential Signal")
%Exponential Signal
e0 = exp(a0*t);
figure()
plot(t,e0)
xlabel("time")
ylabel('e^-t')
title("exponential Signal")
%rectangular Signal
r = rectangularPulse(-2,2,t);
figure()
plot(t,r)
ylim([-3 3]);
title('Rectangular Pulse')
xlabel("time")
ylabel("f(t)")
%square Signal
s = square(t,50);
figure()
plot(t,s)
xlabel("time")
ylabel("f(t)")
ylim([-3 3]);
title('Square Wave')
%Sinc Signal
c = sinc(t);
figure()
plot(t,c)
xlabel("time")
ylabel("f(t)")
title('Sinc signal')