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

2 次查看(过去 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 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by