# NOT RUN {
#Create a vector of time that represent times where data are sampled.
Fs = 100; #sampling frequency in Hz
T = 1/Fs; #sampling period
L = 1000; #length of time vector
t = (0:(L-1))*T; #time vector
#Form a signal (time series) that contains two frequencies:
#1. 10 Hz with amplitude of 1
#2. 25 Hz with amplitude of 2
S <- 1*sin(2*pi*10*t) + 2*sin(2*pi*25*t);
results <- MakePowerSpectralDensity(Fs, S)
frequencies <- results[[1]]
PSD <- results[[2]]
#dev.new()
plot(frequencies, PSD, type = "l")
# }
Run the code above in your browser using DataLab