From: sakly on
thank you Bruno, I tried your solution but the problem remains the same I do not know how to fix this thing
From: Bruno Luong on
"sakly " <saklywissem(a)live.fr> wrote in message <hofdeh$20i$1(a)fred.mathworks.com>...
> thank you Bruno, I tried your solution but the problem remains the same I do not know how to fix this thing

Phase is defined modulo 2*pi so if they differ by 2*pi they are actually equal.

If you want the continuity, apply UNWRAP command on the phase.

Bruno
From: David Young on
"sakly " <saklywissem(a)live.fr> wrote in message <hofbih$307$1(a)fred.mathworks.com>...
> yes I understand but how do I fix this signal, I try to correct but I never succeeded, thank you for helping me

Bruno is right that atan2 is better than atan, but you will still get discontinuities.

A correction to my earlier message. I should have said tan(x) = tan(x + &#960;), and also omitted the other factors of 2.

Anyway, here is a solution provided the signal is smooth enough:

d = diff(y);
yr = y + [0 pi*(cumsum((d < -pi/2) - (d > pi/2)))];

where y is the result of a call to atan and yr is the reconstruction. Here is a test example:

yinit = (-5:0.05:5).^2; % a parabola for testing
z = tan(yinit);
y = atan(z);
plot(y); % has jumps
d = diff(y);
yr = y + [0 pi*(cumsum((d < -pi/2) - (d > pi/2)))];
plot(yr); % smooth

If you use atan2 instead of atan, you will need

yr = y + [0 2*pi*(cumsum((d < -pi) - (d > pi)))];

instead.

From: sakly on
"David Young" <d.s.young.notthisbit(a)sussex.ac.uk> wrote in message <hofece$g2e$1(a)fred.mathworks.com>...
> "sakly " <saklywissem(a)live.fr> wrote in message <hofbih$307$1(a)fred.mathworks.com>...
> > yes I understand but how do I fix this signal, I try to correct but I never succeeded, thank you for helping me
>
> Bruno is right that atan2 is better than atan, but you will still get discontinuities.
>
> A correction to my earlier message. I should have said tan(x) = tan(x + &#960;), and also omitted the other factors of 2.
>
> Anyway, here is a solution provided the signal is smooth enough:
>
> d = diff(y);
> yr = y + [0 pi*(cumsum((d < -pi/2) - (d > pi/2)))];
>
> where y is the result of a call to atan and yr is the reconstruction. Here is a test example:
>
> yinit = (-5:0.05:5).^2; % a parabola for testing
> z = tan(yinit);
> y = atan(z);
> plot(y); % has jumps
> d = diff(y);
> yr = y + [0 pi*(cumsum((d < -pi/2) - (d > pi/2)))];
> plot(yr); % smooth
>
> If you use atan2 instead of atan, you will need
>
> yr = y + [0 2*pi*(cumsum((d < -pi) - (d > pi)))];
>
> instead.
>

the test is perfect but when I apply your solution on my signal does not work

sf =pi/(2*temp_t(length(temp_t)));
I =cos(sf.*c_t);
Q = sin(sf.*c_t);

x=(Q./I);
z=(atan(x))./sf;
d = diff(z);
yr = z + [0 pi*(cumsum((d < -pi/2) - (d > pi/2)))];
From: sakly on
thank you has you and I use "atan2" works well, thank you
Please if you have any idea for GMSK modulation and demodulation contact me thank you