blob: f4e0175594a6cb3d30227f66485dbe31db7c9ef0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
|