Hello again
I tried to extract the amplitude and phase of your x and y signals by "order extraction" , which here is simply a method where you apply the same logic as for a DFT computation, but instead of doing a true integral over N samples , you are simply multiplying the signals by cos and sin of the instantaneous frequency
you can see that the order extraction of the x (input) signal gives the correct amplitude (0.1) and 0 phase (which is normal as x is used to generate the cos signal from where we derive the sin signal).
There is some transient behaviou in the first 10 seconds because of the low pass filter transient behaviour for the real / imaginary part extraction of your signal , so don't pay too much attention at what happens in the first 20 seconds here.
now if you apply the same process to the y signal there is no constant phase , it rolls permanently as if y was not recorded synchronously with x .
even in the spectrogram plots you see from my earlier comments, there is like a small time shift between the x ramp up line and the corresponding y line in the second plot. can you confirm that when you record the data, x and y are recorded synchronously ?
code :
filename = ('Phase_info.csv');
data = readmatrix(filename);
tc1 = find_zc(t,x,max(x)/4);
xi = smoothdata(xi,'gaussian',5);
xi = xi./max(abs(xi(round(samples/4):end)));
[B,A] = butter(2,2/Fs*0.1);
x_amplitude = sqrt(Mr.^2 + Mi.^2);
subplot(2,1,1),plot(t,x_amplitude);
title('X signal modulus / phase extraction')
subplot(2,1,2),plot(t,x_phase);
y_amplitude = sqrt(Mr.^2 + Mi.^2);
subplot(2,1,1),plot(t,y_amplitude);
title('Y signal modulus / phase extraction')
subplot(2,1,2),plot(t,y_phase);
function [Zx] = find_zc(x,y,threshold)
zci = @(data) find(diff(sign(data))>0);
ZeroX = @(x0,y0,x1,y1) x0 - (y0.*(x0 - x1))./(y0 - y1);
Zx = ZeroX(x(ix),y(ix),x(ix+1),y(ix+1));