DSP-CLP-01
DSP-CLP-01
Output:
Output:
Output:
Output:
Output:
k. MATLAB Command:
X= 0:2:16; Y=2*X;
T=linspace(0,2*pi*100);
X=sin(T); Y=cos(T);
plot(X)
plot(Y)
subplot(3,1,1)
plot(X)
subplot(3,1,2)
plot(Y)
subplot(3,1,3)
plot(X,Y)
Output:
b. Matrix Operation:
A=[1 10 30 ; -50 -40 -60 ; 90 70 80 ];
B=[15 18 21 ; -12 20 24 ; 2 4 6];
C=[3 4 5 ; 25 -30 18; 14 27 39];
i) A+B+C
ii) A+B-C
iii) A+B-C-10
iv) A/C
v) A*B*C
vi) 2*A
vii) A^2
vii) A.^2
Output:
c. Matrix Generation:
Matrix Operation: zeros(2,2); ones(3,3); rand(2,3)
Output:
Details: Here,
W’=Transpose Matrix
det(W)=Determinant of W
inv(W)= inverse matrix of W
e. For Loop:
Matrix Operation:
for i = 1:4:20
x = i^4
end
Output:
g. Logical Operator:
Matrix Operation:
x=4; y=6;
if x<1 & y<1
z=0
elseif x>1 & y<1
z=1
elseif x>1 | y<1
z=2
end
Output:
Method 2
syms x y z
[x,y,z]=solve([12*x+20*y-z==0,-2*x+y-15*z==-9,x+y-z==-6],[x,y,z])
Output:
Student Works:
1. Think about A and B are the last two digits of your ID-
B
a. sin(AB°) + cot(BA°) + tan-1 + Be-BA + A*10-A + (log10B)AB + (logeBA)A
A
Output:
a. 17x1+2x2+1x3+5x4=4
5x1+6x2+7x3+1x4=-1
9x1-10x2+11x3+12x4=10
13x1+14x2+15x3-9x4= 6
Output:
Report Questions:
1
1. sin(225°) + cot(30°) + tan-1( ) + 10e-10 + 9*10-2 + (log1010)3 + (loge10)5
2
Output:
10 −12 30
W = 55 95 200
−70 5 2
A=W(3,2)
B=W(1,1)
C=W(3,3)
D=W(2,2)
E=A+B
Output:
Lab report 02
clc;
clear all;
close all;
% Continuous-Time Step Signal
t = -5:0.01:5; % Time vector (continuous domain)
u_t = t >= 0; % Unit step function
subplot(3,1,1);
plot(t, u_t, 'b', 'LineWidth', 2);
xlabel('Time (t)');
ylabel('Amplitude');
title('Continuous-Time Unit Step Signal');
grid on;
axis([-5 5 -0.2 1 2]);
Lab report 03
%signal addition
n = 0:5;
x1 = [1 2 3 4 5 6];
x2 = [6 5 4 3 2 1];
y = x1 + x2;
stem(n, y);
n = 0:5;
x1 = [1 2 3 4 5 6];
x2 = [6 5 4 3 2 1];
y = x1 ./ x2;
stem(n, y);
n = 0:5;
x1 = [1 2 3 4 5 6];
dsp = 2;
y = dsp * x1;
stem(n, y);
%time shifting
n = 0:5;
x1 = [1 2 3 4 5 6];
shift = 2;
n_shifted = n + shift;
stem(n_shifted, x1);
%folding
n = 0:5;
x1 = [1 2 3 4 5 6];
n_folding = -n;
stem(n_folding, x1);
xlabel('n'); ylabel('Amplitude'); title('Folding of sequence');
grid on;
%Sample Summation
x = [1 2 3 4 5 6];
sum_x = sum(x);
disp(['Summation of samples: ', num2str(sum_x)]);
%Sample Multiplication
x = [1 2 3 4 5 6];
prod_x = prod(x);
disp(['Multiplication of samples: ', num2str(prod_x)]);
Lab report 04
Converting a Continuous Time Signal into a Discrete Time Signal:
Input Code:
clc;
clear all;
fm = 10;%Signal Frequency(Hz)
fs_good = 40;%Proper Sampling(fs>2*fm)
fs_bad = 15;%Undwesampling(fs<2*fm)
t = 0:0.001:0.5;%Continuous time
x = cos(2*pi*fm*t);%Original signal
%Undersampling(Aliasing)
n2 = 0:1/fs_bad:0.5;
x2 = cos(2*pi*fm*n2);
%Plot Results
figure;
subplot(3,1,1);
plot(t, x, 'b'); title('Original Continuous-Time Signal'); xlabel('Time'); ylabel('Amplitude'); grid
on;
subplot(3,1,2);
stem(n1, x1, 'r', 'filled'); title('Proper Sampling(fs>2fm)'); xlabel('Time'); ylabel('Amplitude');
grid on;
subplot(3,1,3);
stem(n2, x2, 'g','filled'); title('Alising(fs<2fm)'); xlabel('Time'); ylabel('Amplitude'); grid on;
Output:
Input Code:
clc;
clear all;
%Sampling
n = 0:1/fs:1;%Sampled points
x_sampled=cos(2*pi*fm*n);%sampled signal
%Plot Results
figure;
subplot(3,1,1);
plot(t, x, 'b'); title('Original Continuous-Time Signal'); xlabel('Time'); ylabel('Amplitude'); grid
on;
subplot(3,1,2);
stem(n, x_sampled, 'r', 'filled'); title('Sampled Signal(Discrete Time)'); xlabel('Time');
ylabel('Amplitude'); grid on;
subplot(3,1,3);
plot(t_interp, x_recon, 'g'); title('Reconstructed Signal using Sins Interpolation'); xlabel('Time');
ylabel('Amplitude'); grid on;
Output:
Student Works:
Input code:
clc;
clear all;
% Sampling
n = 0:1/fs:1;
x_sampled = sin(2*pi*fm*n); % Sampled signal (discrete-time)
subplot(3,1,1);
plot(t, x, 'b');
title('Original Continuous-Time Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(3,1,2);
stem(n, x_sampled, 'r', 'filled');
title('Sampled Signal (Discrete Time)');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(3,1,3);
plot(t_interp, x_recon, 'g');
title('Reconstructed Signal using Sinc Interpolation');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
Output: