Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Shifting data
Replies: 2   Last Post: Feb 18, 2010 9:49 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Ben

Posts: 6
From: Netherlands
Registered: 2/18/10
Re: Shifting data
Posted: Feb 18, 2010 9:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.


Date Subject Author
2/18/10
Read Shifting data
Ben
2/18/10
Read Re: Shifting data
Jan Simon
2/18/10
Read Re: Shifting data
Ben

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.