Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Code For Concatenation of Two Signals: All All

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Code for concatenation of two signals

clc;
clear all;
close all;
t = 0:.0001:2;
a=2;
x=a*sin(2*pi*2*t);
subplot(3,1,1)
plot(t,x);
hold on
t = 2:0.0001:4;
b=1;
y = b*sin(2*pi*5*t);
subplot(3,1,2)
plot(t,y)
t = 0:.0001:2;
x=a*sin(2*pi*2*t);
subplot(3,1,3)
plot(t,x);
hold on
t = 2:0.0001:4;
y = b*sin(2*pi*5*t);
subplot(3,1,3);
plot(t,y)

code for addition of two signals


clc;
clear all;
close all;
t = 0:.0001:2;
a=2;
x= a*sin(2*pi*2*t);
subplot(3,1,1)
plot(t,x);
hold on
t = 2:0.0001:4;
b=1;
y = b*sin(2*pi*5*t);
subplot(3,1,2)
plot(t,y)
hold on
z=(a*sin(2*pi*2*t)+b*sin(2*pi*5*t))
subplot(3,1,3);
plot(t,z)
code for generating impulse signal
clc;
clear all;
close all;
t = -3:.0001:3;
l = length(t);
a = [zeros(1,(l-1)/2) ones(1,1) zeros(1,l/2)];
plot(t,a);
axis([-2 2 -2 2])
grid on

code for generating unit step signal


clc;
clear all;
close all;
t = -3:.0001:3;
l = length(t);
a = [zeros(1,l/2) ones(1,1) ones(1,l/2)];
plot(t,a);
axis([-2 2 -2 2])
grid on

code for generating unit ramp signal


clc;
clear all;
close all;
t = 0:.0001:3;
plot(t,t);
axis([0 2 0 2])
grid on

code for generating exponential signal


clc;
clear all;
close all;
t = 0:.0001:5;
a = exp(t)
plot(t,a)
grid on

code for generating sinusoidal signal


clc;
clear all;
close all;
t = -5:.0001:5;
a = 2*sin(t)
plot(t,a)
axis([-5 5 -5 5])
grid on

You might also like