ZeroCrossing on a graph

I have to create a zerocrossing script which says when a graph passes from positive values to negative values (only this case) and then it plots a graph including all these points of zero crossing. Can someone help me with a code?

4 个评论

So... what is your question?
I'm trying to create a code but i can't do it.
Consider what happens to diff(y) and look at
doc sign
for ideas...
if true
% code
plot(sig_AP, 'y')
hold on
for i = 1:length(sig_AP)-1
if ( sig_AP(i)>0 && sig_AP(i+1)<0 )
sig_AP(i+1) = 0-sig_AP(i+1);
x = sig_AP(i);
y = sig_AP(i+1);
if ( x > y )
ZC(i) = sig_AP(i+1);
else
ZC(i) = sig_AP(i);
end
else
ZC(i) = 0;
end
end
ZC = ZC'
plot (ZC, 'k')
end
I try something like this but it doesn't work... i'm not very able with matlab..

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by