From 9fa884beae1633cd9d411e366c7695b4dc5b9a35 Mon Sep 17 00:00:00 2001 From: khannuuuuur Date: Sun, 5 Dec 2021 13:38:35 -0800 Subject: [PATCH] added reverse function --- src/.DS_Store | Bin 6148 -> 6148 bytes src/freqResponse.m | 17 +++++++++++++++++ src/reverse.m | 3 +++ 3 files changed, 20 insertions(+) create mode 100644 src/freqResponse.m create mode 100644 src/reverse.m diff --git a/src/.DS_Store b/src/.DS_Store index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..14624d224e95185f8c871c55d30bb16b7f5a5715 100644 GIT binary patch literal 6148 zcmeHKO-sW-5Pe&FsCenooBIbe3VIJU-qcIgv$htLT3V7+=`BCqH#p5d0y(uZVAvc~+)6GNC&vgRC3c<1c1VCxiTjK4A4Yn$y4*S(F~>2q=gTme_$ zTMF>Z7VGUPdUOR`0aswHfP5b!T`)In6w{}JAzcB8U8a+AjHu~2NHo+1YW5HK<@2y6~y-o~;yf%zBHW_AvK4xj>{$am(+{342+ UKzW7)kiy9(Jj$D6L{=~Z04%N#AOHXW diff --git a/src/freqResponse.m b/src/freqResponse.m new file mode 100644 index 0000000..33d24a8 --- /dev/null +++ b/src/freqResponse.m @@ -0,0 +1,17 @@ +function output = freqResponse(input, H, fs) + + %midterm 1 function: + %H = @(w) (100*j*w*(1+j*w))/(10^(-7)*(1000+j*w)^2*(10+j*w)) + + len = length(input); + f = fs*(-len/2:len/2-1)/len; + + Input = fftshift(fft(input)); + + + Output = zeros(1, length(Input)); + for i=1:length(f) + Output(i) = Input(i) * H(f(i)); + end + output = real(ifft(Output)); +end \ No newline at end of file diff --git a/src/reverse.m b/src/reverse.m new file mode 100644 index 0000000..c14c8ae --- /dev/null +++ b/src/reverse.m @@ -0,0 +1,3 @@ +function output = reverse(input) + output = flip(input); +end \ No newline at end of file