Flat plot using fft-results

Hi, Im a R-neewbe!
I want to use fft on a number of measured data points and plot the result. I know the data should result in some sort of freq. but my plot always ends up flat...
As far as I can see my code dose not take my timesteps in considoration and I don't know how I should make it use them?

My code:
test is the name of my csv datafile and contains of 372 obs. and 2 variables. It has the colums "Time" for the date and time the measurments were made, and "H" for the meassurement, heigh.

[(data <- (test))]

#Convert  date-time to a timearrey
data$Time <- as.POSIXct(data$Time, format="%Y-%m-%d %H:%M:%S")
timeseries <- ts(data$H, frequency=1, start =1)
#Im not sure if I should use 1 for req. of 12 ( I have 12 measurements each day) but the result is the same regarding of what I use

#Do FFT
fft_result <- fft(timeseries)

#Create freq-array
freq <- (1:length(fft_result)-1)*(1/length(fft_result))

#PlottFFT-result
ggplot()+
  geom_line(aes(x = freq, y = Mod(fft_result)), color = 'blue') +
  labs(x = "Frekvens", y = "Amplitud") +
  ggtitle("Fouriertransform")

And the plot produced always just flatlines...
Hopefull for help!

Hi @Ischky, could you post the output of the code below, as described?

``` r
[<-- output of dput(head(test))]
```

(In other words, surround the output of dput(head(test)) with a pair of triple backticks, as shown.)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.