Experiment - 1: A) MATLAB Program To Find Rank, Determinent, Trace and Inverse of The Given Matrix
Experiment - 1: A) MATLAB Program To Find Rank, Determinent, Trace and Inverse of The Given Matrix
EXPERIMENT -2
A) MATLAB Program to generate Unit Impulse Signal
clear all:
m1=input('enter a negative number for m1');
m2=input('enter a postive number for m2');
m=(m1:m2);
X=zeros(1,m2-m1+1);
m0=input('type o for unit impulse negative / postive for delay/advanced
signal');
X(m0-m1+1)=1;
stem(m,X);
axis([m1 m2 -1.5 1.5]);
xlabel('time index t(sec)');
ylabel('amplitude');
title('unit impulse signal sequence');
shifted
ylabel('amplitude');
title('sawtooth signal');
sequence');
EXPERIMENT -3
A) MATLAB Program to perform Addition of two Signals
t=(0:0.01:1);
f1=2;
s1=sin(2*pi*f1*t);
grid;
subplot(3,1,1);
plot(t,s1);
xlabel('time')
ylabel('amplitude')
title('signal1')
f2=4;
s2=3*sin(2*pi*f2*t);
subplot(3,1,2);
plot(t,s2);
xlabel('time');
ylabel('amplitude');
title('signal2');
subplot(3,1,3);
plot(t,s1+s2);
xlabel('time');
ylabel('amplitude');
title('signal 3');
EXPERIMENT -4
MATLAB Program to find Even and Odd parts of signal and also to find real
and imaginary parts of signals
clc;
clear all;
x=[0,2+j*4,-3+j*2,5-j*1,-2-j*4,-j*3,0];
n=-3:3;
xc=conj(x);
xc_folded=fliplr(xc);
xc_even=0.5*[x+xc_folded];
xc_odd=0.5*[x-xc_folded];
figure;
subplot(2,1,1);
stem(n,real(x));
title('real part of complex signal x(n)');
xlabel('time index n');
ylabel('magnitude of real part of x(n)');
subplot(2,1,2);
stem(n,imag(x));
title('imaginary part of complex signal x(n)');
xlabel('time index n');
ylabel('magnitude of imaginary part of x(n)');
figure;
subplot(2,1,1);
stem(n,real(xc_even));
title('real part of even signal xc_even');
xlabel('time index n');
ylabel('magnitude of real part of xc_even');
subplot(2,1,2);
stem(n,imag(xc_even));
title('imaginary part of even signal xc_even');
xlabel('time index n');
ylabel('magnitude of imaginary part of xc_even');
figure;
subplot(2,1,1);
stem(n,real(xc_odd));
title('real part of odd signal xc_odd');
xlabel('time index n');
ylabel('magnitude of real part of xc_odd');
subplot(2,1,2);
stem(n,imag(xc_odd));
title('imaginary part of odd signal xc_odd');
xlabel('time index n');
ylabel('magnitude of imaginary part of xc_odd');