From 84d2e862a6f127c48c0e77f0aa3bfd00a619db1a Mon Sep 17 00:00:00 2001 From: Wouter Horlings Date: Mon, 4 Dec 2017 13:53:03 +0100 Subject: [PATCH] werkende features --- OOequipment/phamag.m | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/OOequipment/phamag.m b/OOequipment/phamag.m index 87346ea..073bb73 100644 --- a/OOequipment/phamag.m +++ b/OOequipment/phamag.m @@ -1,17 +1,19 @@ -function [phase,magnitude] = phamag(wave1,wave2,frequency,T,length) +function [phase,magnitude] = phamag(wave1,wave2,length,frequency,T) %PHAMAG Summary of this function goes here % Detailed explanation goes here wave = [wave1;wave2]; -fft1 = fft(wave); - +Fs = 1/T; +n = 2^nextpow2(length); +X = fft(wave,n,2)/n; +idx = round(frequency*n/Fs) +phase = mod(angle(X(1,idx))-angle(X(2,idx))+pi,2*pi)-pi; +magnitude = X; +for i=1:2 + subplot(2,1,i) + plot(0:(Fs/n):(Fs/2-Fs/n),abs(X(i,1:n/2))) + title(['Row ',num2str(i), ' in the Frequency Domain']) +end - function g = phasefft(wave,length,T) - f = fft(wave); - g = abs(f(1:length/2+1)/length); - figure; - plot(f) - end - end