How can i found the infelction point from the data and remove the data before the first and last infelction points.

Respuestas (2)

The data are quite noisy. After filtering them, it is not obvious what sort of inflection point you want or how to define it.
M1 = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1265285/data.xlsx')
M1 = 1430×2
0 32.2683 0.0050 32.2683 0.0100 32.2683 0.0150 32.2683 0.0200 32.2683 0.0250 32.2683 0.0300 32.2683 0.0350 32.2683 0.0400 32.2683 0.0450 32.2683
x = M1(:,1);
y = M1(:,2);
% yf = sgolayfilt(y, 3, 451);
Fs = 1/mean(diff(x))
Fs = 200
Fn = Fs/2;
L = numel(x);
NFFT = 2^nextpow2(L);
FTy = fft((y-mean(y)).*hann(L),NFFT)/L;
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
figure
semilogy(Fv, abs(FTy(Iv))*2)
grid
xlim([0 10])
yf = lowpass(y, 0.5, Fs, 'ImpulseResponse','iir');
dyfdx = gradient(yf) ./ gradient(x);
d2yfdx2 = gradient(dyfdx) ./ gradient(x);
figure
yyaxis left
plot(x, y, 'DisplayName','Unfiltered Data')
hold on
plot(x, yf, '-r', 'DisplayName','Filtered Data')
hold off
ylabel('Data')
yyaxis right
plot(x, dyfdx, 'DisplayName','First Derivative Of Filtered Data')
hold on
plot(x, d2yfdx2, 'DisplayName','Second Derivative Of Filtered Data')
hold off
yline(0, '-g')
ylabel('Derivatives')
grid
legend('Location','best')
.

8 comentarios

The inflection points can be determined by the second derivative test. that is the point at which the second derivative reaches zero value. can yo help me to locate the points at which the second derivate reaches zero.. in my case, first point and last point is important. but its better to locate all points. i need to cut the data which is at the left side of the first inflection point. can you please help me to figure it out.
Also kindly guide me how i can do this process for two y values realted with one x values at the sam time.
Thanks in advance
Finding the second derivative zero-crossings is straightforward.
Try something like this —
M1 = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1265285/data.xlsx')
M1 = 1430×2
0 32.2683 0.0050 32.2683 0.0100 32.2683 0.0150 32.2683 0.0200 32.2683 0.0250 32.2683 0.0300 32.2683 0.0350 32.2683 0.0400 32.2683 0.0450 32.2683
x = M1(:,1);
y = M1(:,2);
% yf = sgolayfilt(y, 3, 451);
Fs = 1/mean(diff(x))
Fs = 200
Fn = Fs/2;
L = numel(x);
NFFT = 2^nextpow2(L);
FTy = fft((y-mean(y)).*hann(L),NFFT)/L;
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
Fco = 0.5;
figure
plot(Fv, mag2db(abs(FTy(Iv))*2), 'DisplayName','Fourier Transform')
grid
xlim([0 10])
xlabel('Frequency')
ylabel('Magnitude (dB)')
xline(Fco, '-r', 'DisplayName',sprintf('Lowpass Filter Cutoff Frequency: %.2f',Fco))
legend('Location','best')
yf = lowpass(y, Fco, Fs, 'ImpulseResponse','iir');
dyfdx = gradient(yf) ./ gradient(x);
d2yfdx2 = gradient(dyfdx) ./ gradient(x);
d2zix = find(diff(sign(d2yfdx2)));
for k = 1:numel(d2zix) % Second Derivative Zero-Crossings
idxrng = max(1,d2zix(k)-1) : min(d2zix(k)+1, numel(x));
xz(k,:) = interp1(d2yfdx2(idxrng), x(idxrng), 0);
yfz(k,:) = interp1(x, yf, xz(k));
end
Function_Value_At_Inflection_Points = table(xz, yfz, 'VariableNames',{'x','y'})
Function_Value_At_Inflection_Points = 3×2 table
x y ______ ______ 1.4709 34.213 2.4326 36.47 3.188 38.038
figure
yyaxis left
plot(x, y, 'DisplayName','Unfiltered Data')
hold on
plot(x, yf, '-r', 'DisplayName','Filtered Data')
hold off
ylabel('Data')
yyaxis right
plot(x, dyfdx, 'DisplayName','First Derivative Of Filtered Data')
hold on
plot(x, d2yfdx2, 'DisplayName','Second Derivative Of Filtered Data')
hold off
yline(0, '-g', 'DisplayName','Derivatives 0 Line')
for k = 1:numel(xz)
xline(xz(k), '--m', sprintf('x = %.2f',xz(k)), 'DisplayName', sprintf('Inflection Points x = %.2f',xz(k)))
end
ylabel('Derivatives')
grid
legend('Location','best')
This entirely depends on how you want to define the inflection points and how you want to process the signal before calculating them.
.
could you please explain the step by step for the denoising of the data... iam not familiar with that .so facing some difficulties for understanding in first steps for smoothening of data
Thanks in advance
Here, I simply calculated and plotted the Fourier transform, and then used that to choose the passband for the lowpass filter. That choice is a bit empirical, so I experimented until I got a filtered result that I liked. (I initially used the sgolayfilt function, however that did not produce the result that I wanted, so I went with a frequency-selective filtering approach.)
That is all there is to it. As to how I arrived at the approach I used, it is simply the result of my experience in such things.
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Iniciar sesión para comentar.

Categorías

Más información sobre Functions en Centro de ayuda y File Exchange.

Preguntada:

el 16 de En. de 2023

Comentada:

el 27 de En. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by