1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- function [Vout,Iout]=findDP(Xin,Yin,PRMin)
- if PRMin{1}==1 % finding deflection point
-
- if length(PRMin)<2
- DEG=3;
- else
- DEG=PRMin{2};
- end
- for k=1:size(Yin,1)
- Ytmp=Yin(k,:);
- Ytmp(~isfinite(Ytmp))=max(Ytmp(isfinite(Ytmp)));% dealing with nonnumeric values substituting with max
- YinF=filtfilt(0.1*ones(1,10),1,Ytmp);
-
- BB0=diff(YinF,DEG);
- CC=Xin;
- for p=1:DEG
- CC=CC(1:end-1)+diff(CC)/2;
- end
- BB=interp1(CC,BB0,Xin,'nearest','extrap');[Vout(k,1),Iout(k,1)]=min(BB);
- end
- elseif PRMin{1}==2 % finding threshold
-
- if length(PRMin)<2
- ALPHA=0.95;
- else
- ALPHA=PRMin{2};
- end
- for k=1:size(Yin,1)
- Ytmp=Yin(k,:);
- if ~isempty(find(isfinite(Ytmp),1))
-
- Ytmp(~isfinite(Ytmp))=max(Ytmp(isfinite(Ytmp)));% dealing with nonnumeric values substituting with max
- YinF=filtfilt(0.1*ones(1,10),1,Ytmp);
- [Vmin,qwe]=min(YinF);[Vmax,qwe]=max(YinF);Vtsh=Vmin+(1-ALPHA)*(Vmax-Vmin);
-
- Iout(k,1)=find(Yin(k,:)<=Vtsh,1,'first');Vout(k,1)=YinF(Iout(k,1));
- else
- Iout(k,1)=size(Yin,2);Vout(k,1)=NaN;
- end
-
- end
- end
|