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

Guillaume
Guillaume 2017년 9월 18일
So... what is your question?
Nicholas Saladini
Nicholas Saladini 2017년 9월 18일
I'm trying to create a code but i can't do it.
dpb
dpb 2017년 9월 18일
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에 대해 자세히 알아보기

태그

질문:

2017년 9월 18일

댓글:

2017년 9월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by