Tidal data interpolation and fft

Hi!
I have an assignement where I have to interpolate tidal heights from samples mesured earlier.
I used the fft function to find the frequency components of the given signal. The signal starts in April 2017 and ends approximately 1 month later, sampled every hour.
Now, what I have to do is find tidal heights for one day in March 2018. The interpolation begins 8088 hours after the sample of April 2017 and I have to interpolate the heights every minute (intervals of 1/60 of an hour) minus 3 minutes.
When I use the code below:
k = 1;
for t = 8088:1/60:8088 + length(hours)/20 - 3/60 % Data to interpolate starts 8088 hours after the sample, interpolation every minute
sum = 0;
for j = 1:N
sum = sum + (Y(j) * exp(1i * 2 * pi() * t * (j-1) / N);
end
Z(k,1) = abs(sum);
k = k + 1;
end
I get this graph:
The orange line is the interpolation I get and the blue line represents the values measured by a tidal station (both lines should be very similar, identical). I can see that the interpolated values are exact every hour (8088, 8089, 8090, ...), but not in between. Why is that? Is it because the sample rate is not the same (one hour to get fft, 1 minute for interpolation)? How can I resolve the code to have the desired effect?
Thank you!

Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Products

Release

R2017b

Asked:

on 19 Mar 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!