aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich Beckmann <friedrich.beckmann@gmx.de>2023-03-29 06:51:35 +0200
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>2023-03-29 06:51:35 +0200
commit47ed98f08a7d0ee14bcde29036a77431cc358e40 (patch)
tree7373ac101d62d8c6d188b6ab3457e7cb973ee94f
parentacb927555f077ffc80bc38575537e9bf2a5b5793 (diff)
matlab: add dds phase model
-rw-r--r--matlab/dds/doph.m30
1 files changed, 30 insertions, 0 deletions
diff --git a/matlab/dds/doph.m b/matlab/dds/doph.m
new file mode 100644
index 0000000..f4e0175
--- /dev/null
+++ b/matlab/dds/doph.m
@@ -0,0 +1,30 @@
+function res = doph()
+% 20 ns Samplinginterval = 50 MHz Sampling Frequency
+dt = 20E-9; %Sample interval
+Fs = 1/dt; %Sampling Frequency
+Ns = 64; %Number of Samples to Compute
+freq = 6.25E6; % Frequency of the sinewave
+%freq = 6E6;
+t = 0:dt:(Ns-1)*dt
+%t = 0:dt:1023*dt;
+p = freq*t; % phase is scaled by 1/(2*pi)
+pm = mod(p,1.00); %Modulo phase
+y = sin(2*pi*pm);
+figure(1)
+clf
+plot(p,y,'-o');
+hold on
+plot(p,pm,'-o');
+% Power Spectrum
+figure(2)
+clf
+pspectrum(y,Fs)
+%pspectrum(y,Fs,'Leakage',1)
+
+% FFT
+s = fft(y/Ns);
+figure(3)
+stem(abs(s));
+
+res = y;
+end \ No newline at end of file