필터 지우기
필터 지우기

Points of Inflection for Sine Curve

조회 수: 52 (최근 30일)
Osita Onyejekwe
Osita Onyejekwe 2016년 11월 1일
댓글: dpb 2016년 11월 1일
In the code below, I have successfully detected the peaks of the sine curve. I have also put the peaks on the plot. May someone PLEASE help me now identify the points of inflection. It is where the graphs goes from concave up to concave down (NOT the peaks). The points of inflection should be points across the Sine curve that go across the middle of the graph. The code is below. If you could also mark the points on the graph that would be much appreciated. Thanks!
I found a solution to this problem, it stated that
***************************************************************************** "If your curve are data (not calculated by a function) I would use the gradient function to calculate the derivative. To find the zero-crossing of the derivative, you can either use a threshold test, or if appropriate for your derivative, the interp1 function." *************************************************************************
I just dont know how to code the above..but here is my code again below. Thanks again guys: Basically,inflection points in the signal is to be determined automatically by detecting zero-crossings in derivatives of the signal. I need help finding the zero-crossings of the signal. Thank you!!
x = 1:500;
X = x;
J = 1;
Fs = 499;
N = J*Fs;
t = 0: 1/Fs : J;
Fn = 3; % this control the number of cycles/periods
deltaJ = 0.0020;
deltax = 1;
y_sine_25HZ = sin(Fn*2*pi*t);
y = y_sine_25HZ ;
plot(x,y, 'k.')
% drvY = diff(y)/deltax; % one unit shorter than y
% drvY = [drvY , drvY(end)]; % making up for the missing point
% secondDrvY = diff(drvY)/deltax;
% secondDrvY = [secondDrvY, secondDrvY(end)];
% [~,locup]=findpeaks(y) % (+)ive peaks % location up
% [~,locdn]=findpeaks(-y) % (-)ive peaks (positive negative y) % location down
dy=[0 sign(diff(y))];
locdn = find((diff(dy))==2) % location down
locup = find((diff(dy))==-2) % location up
plot(t,y)
ylim([-1.05 1.05])
hold on
scatter(t(locup)',y(locup)',30,'r','*')
scatter(t(locdn)',y(locdn)',30,'g','d','filled')
  댓글 수: 3
Osita Onyejekwe
Osita Onyejekwe 2016년 11월 1일
I completely understand your technique, and I understand the mathematics in solving for the zero crossing, I just have a problem putting it into code. Zero crossing is when the second derivative crosses the zero -line from positive to negative and the first derivative has a local maxima. I'm just a week new to Matlab...so its all new to me ..i just need a little help on this one and I'm good to go
dpb
dpb 2016년 11월 1일
find(abs([0 diff(sign(y)])==2)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by