How to plot common zero crossings of 3 different signals (3 sinusoidal signals)?

조회 수: 6 (최근 30일)
Hi, I am new to Matlab.
I am looking to plot the common zero crossings of three signals
Ex: I have 3 sine waves:
x = sin(2*pi*fo*t);
x1 = sin(t+sin(t.^2));
x2 = x+x1;
I need to find and plot the common zero crossing points in all the three signals.
Can anyone please help me out with this?

채택된 답변

Gurudatha Pai
Gurudatha Pai 2013년 5월 1일
This may sub-optimal but definitely a start. I would find the zero crossings of each as a vector of 1's and 0's and add them. Then find the sum of them.
x_index = ZeroCrossing(x);
x1_index = ZeroCrossing(x1);
x2_index = ZeroCrossing(x2);
sum_index = x_index+x1_index+ x2_index ;
ZC_index = (sum_index == 3);
function x = ZeroCrossings(x)
x(x>0) = 1;
x(x<0) = 0;
x = abs(diff(x));
end
Hope that gives you some idea! I am certain others will have better way of doing it!
I think the above code should work, but I haven't tested it!! So, please be advised!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by