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 Kommentare

Guillaume
Guillaume am 18 Sep. 2017
So... what is your question?
Nicholas Saladini
Nicholas Saladini am 18 Sep. 2017
I'm trying to create a code but i can't do it.
dpb
dpb am 18 Sep. 2017
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..

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 18 Sep. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by