Backwards Interpolation of Phase-Shifted Signal Waveform

3 views (last 30 days)
I have a waveform plot that I phase shifted forward and now I need to do a backwards interpolation to fill in the missing data. I'm instructed specifically to use the spline interpolation. I'm not sure how to go about this since interpolating the phase-shifted signal results in the graph shooting up towards infinity as t goes to zero.
If you execute the code below you will be able to see the missing part of the curve that I need to interpolate. It's in the beginning from 0 to ~0.25 seconds. Please advise!
t = [0.04 0.08 0.12 0.17 0.43 0.48 0.53 0.58 0.64 0.67 0.75 0.92];
y = [0.59 0.95 0.96 0.25 0.16 0.95 0.89 0.31 -0.59 -0.89 -0.71 0.95];
timePeriod = 0.4119
tDesired = linspace(0,1,1000);
R1 = spline(t,y,tDesired);
R2 = R1; %copy of interpolated curve
t2 = tDesired + (timePeriod/2); %phase shift R2
yDesired = spline(t2,R2,tDesired); %spline interpolation of phase shifted curve -- but this does not work properly!
finalWave = R2 - R1;
figure
plot(t2,R2) %plot of the phase-shifted signal
hold on
plot(t,y,'O') %plot ambient noise raw data
plot(tDesired,R1) %plot original ambient noise interpolation (R1)
plot(tDesired,finalWave) %plot final waveform
title('Destructive Interference')
xlabel('Time (seconds)')
ylabel('y')
legend('Phase-Shifted Signal','Ambient Noise Data','Ambient Noise','Final Waveform')
hold off

Answers (0)

Community Treasure Hunt

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

Start Hunting!