diff --git a/Inverse.sce b/Inverse.sce new file mode 100644 index 0000000..de626b3 --- /dev/null +++ b/Inverse.sce @@ -0,0 +1,37 @@ +//AU2040241 Priyanshu Pathak +clear;clc; +x = [1 2 3 4 5 6]; +kx = 3; +element = x(kx); +N = length(x); +y = x; + +for i=1:N + y(N-i+1) = x(i); +end +for i=1:N + if y(i)==element then + ky = i; + end, +end +printf("x(n): "); +disp(x); +printf("y(n): "); +disp(y); +printf("ky: "); +disp(ky); +//Output: + +//x(n): +// 1. 2. 3. 4. 5. 6. +//y(n): +// 6. 5. 4. 3. 2. 1. +//ky: +// 4. + +//x(n): +// 1. 2. 3. 4. 5. 6. +//y(n): +// 6. 5. 4. 3. 2. 1. +//ky: +// 4. diff --git a/Music-with-upsamling.sce b/Music-with-upsamling.sce new file mode 100644 index 0000000..5950c84 --- /dev/null +++ b/Music-with-upsamling.sce @@ -0,0 +1,35 @@ +// AU2040241 Priyanshu Pathak +clear; clc; +function [x, L]=Eq(x, L) + N = length(x); + y = zeros(1:L*N); + y([1:L:length(y)])= x; +endfunction +RN = 241; +fs = (RN/3) + 200; // fs = 280.333 hz +d = 0.4; +t = 0:1/11025:d; +t2 = 0:1/22050:d; +En = sin(%pi*t/d); +En2 = sin(%pi*t2/d); +fr = fs*2^(2/12); + +fg = fs*2^(4/12); + +Sa = En.*sin(2*%pi*fs*t); +Sa2 = En2.*sin(2*%pi*fs*t2); +Re = En.*sin(2*%pi*fr*t); +Re2 = En2.*sin(2*%pi*fr*t2); +Ga = En.*sin(2*%pi*fg*t); +Ga2 = En2.*sin(2*%pi*fg*t2); +x = [Sa Re Ga Re Sa]; +z = [Sa2 Re2 Ga2 Re2 Sa2]; +L = 2; //Upsampling factor +[x,L] = Eq(x,L); +sound(x); +analyze(x); +wavwrite(x, fs, 'first_wave.wav'); +[x,L] = Eq(z,L); +sound(z); +analyze(z); +wavwrite(z, fs, 'second_wave.wav');