find index of missing data point/ extrapolatation

조회 수: 3 (최근 30일)
Akhtar Rind
Akhtar Rind 2020년 7월 24일
댓글: Star Strider 2020년 7월 27일
I want fo find time and index when current is 90% of peak value during rise and fall.
Its easy to find rise but during fall, current drop quickly and there is no data point/index available at 90% of peak value.
How can I get index and time at 90% fall/drop value? probably by extrapolation or data fiting. please help.
Thanks
A1= load('data.txt');
T=A1(:,1); %Time
I=A1(:,2); %Current
[Imx,iImx]=max(I); %locate peak value and index in current
i90=find(I>=Imx*0.9,1,'first'); % First 90% of Peak during rise.
ii90=find(I>=Imx*0.9,1,'last'); % Last/second 90% of peak during fall
T90R=T(i90);
T90F=T(ii90);
plot(T,I,'.'); hold on
plot(T(i90),I(i90),'bs','LineWidth',2 ,'MarkerSize',6)
plot(T(i90),I(i90),'bs','LineWidth',2 ,'MarkerSize',6)
hold off

채택된 답변

Star Strider
Star Strider 2020년 7월 24일
편집: Star Strider 2020년 7월 24일
Another option:
A1= load('data.txt');
T=A1(:,1); %Time
I=A1(:,2); %Current
[Imx,iImx]=max(I); %locate peak value and index in current
i90 = find(diff(sign(I-0.7*Imx))); % Finds Both Crossing Indices (Does Not Need To Be Exact)
for k = 1:numel(i90)
idx = i90(k)+[-2 2];
I90(k) = interp1(I(idx), T(idx), 0.9*Imx, 'linear','extrap'); % Interpolate To Find More Precise Times
end
figure
plot(T,I)
hold on
plot(I90, 0.9*Imx*[1 1],'bs')
hold off
grid
xlabel('Time')
ylabel('Current')
producing:
Note that this will not find the indices, because there are no indices corresponding exactly to the 90% values. It will find the approximate corresponding times (within the precision limits of the data) for both of those points.
EDIT — (24 Jul 2020 at 12:53)
Corrected typographical error.
  댓글 수: 4
Akhtar Rind
Akhtar Rind 2020년 7월 27일
Thank you very much for this explaination.
Star Strider
Star Strider 2020년 7월 27일
As always, my pleasure!

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

추가 답변 (1개)

John D'Errico
John D'Errico 2020년 7월 24일
편집: John D'Errico 2020년 7월 24일
Use the intersections code, written by Doug Schwarz, found for download from the file exchange.
I90 = 0.9*max(I);
[Tint,Iint] = intersections(T,I,[min(T),max(T)],[I90,I90])
Tint =
4.118e-05
4.78765517241379e-05
Iint =
69.49044
69.49044
Note that intersections uses linear interpolation to locate the points.

카테고리

Help CenterFile Exchange에서 Phased Array Design and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by