Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions first.sce
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Namit Shah , AU1841067
// Programming Assignment
// Signals & Systems , Semester 3

// Question 1 --> Sampling index

clear;
clc;

function y = n(x,k)
y = [];
len = length(x);
for i = 1:len
y($+1) = i-k;
end
endfunction

vx = [];
l = input("Enter length of vector : ");
disp("Enter vector (Press Enter after each input) : ");
for i = 1:l
vx(i) = input("");
end
k = input("Enter value of k : ")
ans = n(vx,k);
disp(ans);
17 changes: 17 additions & 0 deletions prac1(duty).sce
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
clear;
clf;
clc;
x=[ones(1:5),zeros(1:95)];
y=[ones(1:50),zeros(1:50)];
xf=fft(x);
yf=fft(y);
xfa=abs(xf);
yfa=abs(yf);
subplot(211);
plot2d3(xfa);
xgrid(4);
title("Spectrum of pluse waveform with 5% duty cycle","fontsize",4);
subplot(212);
plot2d3(yfa);
xgrid(4);
title("Spectrum of pluse waveform with 50% duty cycle","fontsize",4);
9 changes: 9 additions & 0 deletions randfilt.sce
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
clear;
clf;
r = rand(1, 100) - 0.5;
subplot(211);
plot(r);
subplot(212);
c = ffilt("lp", 21, 0.1);
y = filter(c, 1, r);
plot(y);
28 changes: 28 additions & 0 deletions second.sce
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Namit Shah , AU1841067
// Programming Assignment
// Signals & Systems , Semester 3

// Question 2 --> Down Sampling

clear;
clc;

function y = downsampling(x,M)
y = [];
len = length(x);
for i = 1:M:len
y($+1) = x(i);
end
endfunction


x = [];
l = input("Enter length of vector : ");
disp("Enter vector (Press Enter after each input) : ");
for i = 1:l
x(i) = input("");
end
M = input("Enter the down sampling factor M : ");
ans = downsampling(x,M);
disp("Down Sampled Vector : ");
disp(ans);
31 changes: 31 additions & 0 deletions third.sce
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Namit Shah , AU1841067
// Programming Assignment
// Signals & Systems , Semester 3

// Question 3 --> Up Sampling

clear;
clc;

function y = upSampling(x,L)
y = [];
len = length(x);
for i = 1:L.*len
if modulo(i-1,L)==0
y($+1) = x(((i-1)./L)+1);
else
y($+1) = 0;
end
end
endfunction

x = [];
l = input("Enter length of vector : ");
disp("Enter vector (Press Enter after each input) : ");
for i = 1:l
x(i) = input("");
end
L = input("Enter the up sampling factor L : ");
ans = upSampling(x,L);
disp("Up Sampled Vector : ");
disp(ans);
14 changes: 14 additions & 0 deletions xnxt.sce
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
clear;
clf;
dn = 1;
dt = 1/50;
n = -1 : dn : 1;
t = -1 : dt : 1;
f = 5;
fs = 50;
x = cos(2*%pi*f*t);
y = cos(2*%pi*(f/fs)*n);
subplot(211);
plot2d(t, x);
subplot(212);
plot2d3(n, y);