Matlab output is not matching with the mathematics...
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hari Ijjada
el 25 de Nov. de 2019
Comentada: Walter Roberson
el 25 de Nov. de 2019
S1=cos(2*pi*f1*t);
S2=cos(2*pi*f2*t);
arg1=acos(S1)=2*pi*f1*t;
arg2=acos(S2)=2*pi*f2*t;
cos(arg1-arg2)=cos(2*pi*(f1-f2)*t);
But output is not coming as expected.if you observe the frequency spectrum of both they are not same.
Why it is happening ?
2 comentarios
per isakson
el 25 de Nov. de 2019
Editada: per isakson
el 25 de Nov. de 2019
Which values do you use for f1, f2 and t ? What differences do you see? Are they large compared to the expected floating point error?
KALYAN ACHARJYA
el 25 de Nov. de 2019
arg1=acos(S1)=2*pi*f1*t;
This is not a valid Matlab statement.
Respuesta aceptada
David Goodmanson
el 25 de Nov. de 2019
Editada: David Goodmanson
el 25 de Nov. de 2019
Hi Hari,
the problem is that 2*pi*f*t is a nice linear function of t for all t, but the output of acos is restricted to the range
0<= acos <pi. With
t = 0:.001:5;
f1 =1;
S1 = cos(2*pi*f1*t);
arg1 = acos(S1)
figure(1)
plot(t,2*pi*f1*t,t,arg1)
grid on
you will see that the two quanities agree at the beginning, but acos gets chopped up as t increases.
If you compare the cosines of (2*pi*f1*t) and arg1, then those agree as they must. But with cos(arg1-arg2) you are taking the cosine of the difference of two chopped up quantities with different periods, and it doesn't work.
4 comentarios
Walter Roberson
el 25 de Nov. de 2019
i followed this process........x1=acos(Signal1)....acos------>gives inverse of the Signal1.......2*pi*fc*t
That process is incorrect. acos(cos(2*pi*fc*t)) does not give 2*pi*fc*t outside of t in [0, 1/(2*fc)]
Más respuestas (1)
Walter Roberson
el 25 de Nov. de 2019
arg1=acos(S1)=2*pi*f1*t;
arg2=acos(S2)=2*pi*f2*t;
Not correct. As you increase t past one period, acos(cos(x)) becomes mod(x,period) rather than x. Those mod() of the two components interact with each other.
Ver también
Categorías
Más información sobre Discrete Fourier and Cosine Transforms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!