From: sakly on
bits = [1,1,-1,1,1,-1,-1,1,-1,1,-1,-1, 1,1,-1,1,1,-1,-1,1,-1,1,-1,-1];
BT = 0.5;
R = 2000;
fc = 1200;
te = 2500;
T = 1/R;
B = 1000;
t = -T : T/te : T;
y1=2*pi*BT*((t-T/2)/(T*sqrt(log(2))));
y2=2*pi*BT*((t+T/2)/(T*sqrt(log(2))));
g=(1/(2*T*sqrt(pi)))*(erfc(y1/sqrt(2))-erfc(y2/sqrt(2)));

b_t = zeros(1, (length(bits)+1)*te+1);
for n = 1 : length(bits)
t1 = zeros(1, (n-1)*te);
t2 = [t1 bits(n)*g];
t3 = zeros(1, length(b_t) - length(t2));
t4 = [t2 t3];
b_t = b_t + t4;
end

for n = 2 : length(b_t)
b_t(n) = b_t(n - 1) + b_t(n);
end
c_t = b_t;
temp_t = g;

for n = 2 : length(temp_t)
temp_t(n) = temp_t(n - 1) + temp_t(n);
end
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;
plot(z)
hold on
plot(c_t)
%le signal original n'est pas le meme que je trouve apres la atan il y a une discontinuité %de signal z
From: David Young on
Here's a guess at the problem and at the answer, though you don't provide much help in your question.

You should expect discontinuities in the output of atan. For all x, tan(x) = tan(x+2π), so if y = tan(x), what should atan(y) return? It could be x, or x+2π, or x+2Nπ for any N. In fact, the Matlab atan function always returns a result in the range [–π/2, π/2] in order to give some answer. Where the original signal crossed the boundary of the range there will be a discontinuity.

If the time series is sufficiently smooth, you can reconstruct the signal (up to an additive constant) by adding in multiples of 2π after each discontinuity - it's one line if you use diff and cumsum.
From: sakly on
yes I understand but how do I fix this signal, I try to correct but I never succeeded, thank you for helping me
From: sakly on
yes I understand but how do I fix this signal, I try to correct but I never succeeded, thank you for helping me
From: Bruno Luong on
"sakly " <saklywissem(a)live.fr> wrote in message <hof7qh$pg$1(a)fred.mathworks.com>...

> x=(Q./I);
> z=(atan(x))./sf;

use
z = atan2(Q,I)./sf

Bruno