MATLAB Full Lab Report
MATLAB Full Lab Report
MATLAB Full Lab Report
Introduction:
This lab is based on generation of a continuous time signal by MATLAB
Software simulation:
MATLAB is used for performing experiment.
Results:
Lab # 2nd
Title:
To plot a simple oscillatory function.
Introduction:
This lab is based on generation of an oscillatory function.
Software simulation:
MATLAB is used for performing experiment.
Results:
Lab # 3rd
Title:
To plot a simple discrete time signal.
Introduction:
This lab is based on generation of a discrete time signal.
Software simulation:
MATLAB is used for performing experiment.
%CASE4(a<-1)
c=2;
a=-5;
n=0:15;
x=c*a.^n;
subplot(2,1,2);
stem(n,x,'LineWidth',1.5);
title('CASE a<-1');
xlabel('TIME');
ylabel('AMPLITUDE');
grid on;
%CASE5(a=1)
c=2;
a=1;
n=0:15;
x=c*a.^n;
figure(3);
subplot(2,1,1);
stem(n,x,'LineWidth',1.5);
title('CASE a=1');
xlabel('TIME');
ylabel('AMPLITUDE');
grid on;
%CASE6(a=-1)
c=2;
a=-1;
n=0:15;
x=c*a.^n;
subplot(2,1,2);
stem(n,x,'LineWidth',1.5);
title('CASE a=-1');
xlabel('TIME');
ylabel('AMPLITUDE');
grid on;
Results:
Lab # 4TH
Title:
To plot a simple piecewise signal.
Introduction:
This lab is based on generation of a Piecewise signal.
Software simulation:
MATLAB is used for performing experiment.
Introduction:
This lab is based on scaling and time shifting.
Software simulation:
MATLAB is used for performing experiment.
x2=sin(2*t);
subplot(2,1,2);
plot(t,x2,'linewidth',2);
Xlabel('Time t');
Ylabel('Sin (2t)');
axis([-2.5*pi 2.5*pi -1.25 1.25]);
set(gca,'Xtick',-2.5*pi:pi/2:2.5*pi);
set(gca,'Ytick',-2.5:0.25:2.5);
grid on;
figure(2); %Figure 1
t=-2*pi:pi/10:2*pi;
x1=sin(t);
subplot(2,1,1);
plot(t,x1,'linewidth',2);
Xlabel('Time t');
Ylabel('Sin (t)');
axis([-2.5*pi 2.5*pi -1.25 1.25]);
set(gca,'Xtick',-2.5*pi:pi/2:2.5*pi);
set(gca,'Ytick',-2.5:0.25:2.5);
grid on;
x3=sin(0.5*t);
subplot(2,1,2);
plot(t,x3,'linewidth',2);
Xlabel('Time t');
Ylabel('Sin (t/2)');
axis([-2.5*pi 2.5*pi -1.25 1.25]);
set(gca,'Xtick',-2.5*pi:pi/2:2.5*pi);
set(gca,'Ytick',-2.5:0.25:2.5);
grid on;
figure(3); %Figure 3
t=-2*pi:pi/10:2*pi;
x1=sin(t);
subplot(2,1,1);
plot(t,x1,'linewidth',2);
Xlabel('Time t');
Ylabel('Sin (t)');
axis([-2.5*pi 2.5*pi -1.25 1.25]);
set(gca,'Xtick',-2.5*pi:pi/2:2.5*pi);
set(gca,'Ytick',-2.5:0.25:2.5);
grid on;
x4=sin(-t);
subplot(2,1,2);
plot(t,x4,'linewidth',2);
Xlabel('Time t');
Ylabel('Sin (-t)');
axis([-2.5*pi 2.5*pi -1.25 1.25]);
set(gca,'Xtick',-2.5*pi:pi/2:2.5*pi);
set(gca,'Ytick',-2.5:0.25:2.5);
grid on;
figure(4); %Figure 4
t=-2*pi:pi/10:2*pi;
x1=sin(t);
subplot(2,1,1);
plot(t,x1,'linewidth',2);
Xlabel('Time t');
Ylabel('Sin (t)');
axis([-2.5*pi 2.5*pi -1.25 1.25]);
set(gca,'Xtick',-2.5*pi:pi/2:2.5*pi);
set(gca,'Ytick',-2.5:0.25:2.5);
grid on;
x5=sin(t+(pi/2));
subplot(2,1,2);
plot(t,x5,'linewidth',2);
Xlabel('Time t');
Ylabel('Sin (t+pi/2)');
axis([-2.5*pi 2.5*pi -1.25 1.25]);
set(gca,'Xtick',-2.5*pi:pi/2:2.5*pi);
set(gca,'Ytick',-2.5:0.25:2.5);
grid on;
figure(5); %Figure 5
t=-2*pi:pi/10:2*pi;
x1=sin(t);
subplot(2,1,1);
plot(t,x1,'linewidth',2);
Xlabel('Time t');
Ylabel('Sin (t)');
axis([-2.5*pi 2.5*pi -1.25 1.25]);
set(gca,'Xtick',-2.5*pi:pi/2:2.5*pi);
set(gca,'Ytick',-2.5:0.25:2.5);
grid on;
x6=sin(t-(pi/2));
subplot(2,1,2);
plot(t,x6,'linewidth',2);
Xlabel('Time t');
Ylabel('Sin (t-pi/2)');
axis([-2.5*pi 2.5*pi -1.25 1.25]);
set(gca,'Xtick',-2.5*pi:pi/2:2.5*pi);
set(gca,'Ytick',-2.5:0.25:2.5);
grid on;
Results:
Lab # 6TH
Title:
Continuous time Convolution of a signal.
Introduction:
This lab is based on convolution.
Software simulation:
MATLAB is used for performing experiment.
Introduction:
This lab is based on convolution.
Software simulation:
MATLAB is used for performing experiment.
subplot(3,1,2);
stem(n,h); %Plotting Impulse Responce
title('Impulse Responce Of System');
grid on;
subplot(3,1,3);
stem(n1,y); %plotting of output Of system
title('Convoled Signal');
grid on;
Results:
Lab # 8TH
Title:
Solving Derivative, Partial Derivative, Integral, Definite
Integral.
Introduction:
This lab is based on solving equation.
Software simulation:
MATLAB is used for performing experiment.
SOLVING EQUATIONS
Program And Simulation:
%solving derivative, partial derivative, Integral, definite
integral
clc
clear all
syms a b c d e g h f1 f2 f3 x y;
%Derivative
f1=3*x^3-4*x^2+5*x-3;
a=diff(f1,x) %First order derivative
b=diff(a,x) %2nd Order derivative
c=diff(b,x) %3rd Order derivative
%Partial derivative
f2=x^2*y+x*y^3-x^3+y^2;
d=diff(f2,x) %Derivative w.r.t x
e=diff(f2,y) %Derivative w.r.t y
%Integral
f3=3*x^3-4*x^3;
g=int(f3,x)
h=int(f3,x,0,5) %Definite Integral
Results:
a = 9*x^2 - 8*x + 5
b = 18*x – 8
c = 18
d = - 3*x^2 + 2*x*y + y^3
e = x^2 + 3*x*y^2 + 2*y
g = -x^4/4
h = -625/4
Lab # 9TH
Title:
Implementation of Laplace Transform & Z-Transform.
Introduction:
This lab is based on solving equation.
Software simulation:
MATLAB is used for performing experiment.
f2-(0.5)^(n-3);
x2=ztrans(f2) %Z-Transform
Results:
x1 = pi^(1/2)/s^(1/2)
x2 = z/(z - 1)^2
Lab # 10TH
Title:
Plot Continuous time square wave & Triangular wave
Introduction:
This lab is based on solving equation.
Software simulation:
MATLAB is used for performing experiment.
%Triangular Wave
clc
clear all
t_wave=0;
t=0:0.01:10;
for n=1:2:1000
trngl_wave=(8/(n^2*pi^2))*((-1)^((n-1)/2))*(sin(n*pi*t/2));
t_wave=t_wave+trngl_wave;
end
subplot(2,1,2);
plot(t,t_wave);
axis([0 10 -2 2]);
title('Triangular Wave');
xlabel('Time');
ylabel('Amplitude');
Results:
Lab # 11TH
Title:
a) Fourier series.
Introduction:
This lab is based on solving equation & Plotting.
Software simulation:
MATLAB is used for performing experiment.
Program And Simulation:
%Fourier Series
clc
clear all
syms x y
f=exp(-x^2);
fourier(f,x,y)
y=fft(x);
figure;
plot(f,y);
xlabel('Frequency');
ylabel('Amplitude');
title('Fourier Transform');
z=ifft(y);
figure;
plot(t,z);
xlabel('Time');
ylabel('Amplitude');
title('Inverse Fourier Transform');
Results:
Signal:
F.T:
Inverse F.T:
Lab # 12TH
Title:
Introduction to Simulink.
Introduction:
This lab is based on convolving signals.
Software simulation:
MATLAB is used for performing experiment.
Program And Simulation:
Results: