Matlab output is not matching with the mathematics...

조회 수: 5 (최근 30일)
Hari Ijjada
Hari Ijjada 2019년 11월 25일
댓글: Walter Roberson 2019년 11월 25일
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
per isakson
per isakson 2019년 11월 25일
편집: per isakson 2019년 11월 25일
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
KALYAN ACHARJYA 2019년 11월 25일
arg1=acos(S1)=2*pi*f1*t;
This is not a valid Matlab statement.

댓글을 달려면 로그인하십시오.

채택된 답변

David Goodmanson
David Goodmanson 2019년 11월 25일
편집: David Goodmanson 2019년 11월 25일
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
Hari Ijjada
Hari Ijjada 2019년 11월 25일
i am trying to develop the algorithim to provide the deviation in the phase or frequency b/w two signals.
if you see the above problem,there is a deviation between my two inputs
Signal1=cos(2*pi*fc*t),Signal2=cos(2*pi*(fc+f_delta)*t)
By taking these two signals as inputs i want to find the f_delta value.
This f_delta value is not constant..it varies from time to time.Whatever the value it is i have to track the f_delta.
For this purpose i used complex muliplication process.
exp(1i*(2*pi*(fc+f_del)*t)) , exp(-1j*2*pi*fc*t)
if i multiply these two signals output should be exp(1j*2*pi*f_del*t)
real value of the output is---cos(2*pi*f_del*t)
this is output is i will use for the further blocks.
but I am not getting as expected(expected output is cos(2*pi*f_del*t) ).
How to find the desired output ?
Walter Roberson
Walter Roberson 2019년 11월 25일
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)]

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2019년 11월 25일
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.
  댓글 수: 1
Hari Ijjada
Hari Ijjada 2019년 11월 25일
Can you please help me solving this issue ...
i am trying to develop the algorithim to provide the deviation in the phase or frequency b/w two signals.
if you see the above problem,there is a deviation between my two inputs
Signal1=cos(2*pi*fc*t),Signal2=cos(2*pi*(fc+f_delta)*t)
By taking these two signals as inputs i want to find the f_delta value.
This f_delta value is not constant..it varies from time to time.Whatever the value it is i have to track the f_delta.
For this purpose i used complex muliplication process.
exp(1i*(2*pi*(fc+f_del)*t)) , exp(-1j*2*pi*fc*t)
if i multiply these two signals output should be exp(1j*2*pi*f_del*t)
real value of the output is---cos(2*pi*f_del*t)
this is output is i will use for the further blocks.
but I am not getting as expected(expected output is cos(2*pi*f_del*t) ).
How to find the desired output ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Signal Generation and Preprocessing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by