Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
Ben
Posts:
6
From:
Netherlands
Registered:
2/18/10
|
|
Re: Shifting data
Posted:
Feb 18, 2010 9:49 AM
|
|
Dear Jan Simon,
Thanks for your reply. I'm sorry for my explanation. But I have the solution.
function [x] = FuncFindTrig(signal, trig)
% Find point closest to trigger point (trig)
% find point closest to trig B1 = abs(signal-trig); [C,D] = min(B1);
% when first point is bigger than trig, use second point B2 = signal>trig;
% sig1 = x>trx; sig2 = B2(2:end) - B2(1:end-1); B3 = find (sig2==1);
if B3(1)==1; B3(1)= B3(2)+1; else B3(1)=B3(1)+1; end
UPx = B3(1); LPx = B3(1)-1; UPy = signal(UPx); LPy = signal(LPx);
% a = delY/delX; a = (UPy-LPy)/(UPx-LPx); b = signal(LPx);
% y = ax+b; x = LPx+(trig-b)/a; end
This is my solution: % shifting figures to same point xA and xB must be zero Bsize= size(B);
% B2=B(xBtrig:end) t= 1-xBtrig:1:Bsize(2)-xBtrig;
figure; plot(t,B) FuncHorline(trig); FuncVertline(0);
It is of course only the display of the figure that needed to be changed, not the data as such.
|
|
|
|