How can you do a baseline shift on an acceleration-time history data file?
Show older comments
This is easy to do in DPlot, but we are finding that there is some sort of wierd single to double precision conversion operation that tends to corrupt the time steps. I'm assuming Matlab can do a baseline shift without corrupting the data. Is there a built-in function in Matlab? Some simple code that can be used in a script file?
2 Comments
Wayne King
on 7 Feb 2013
Can you be more specific on what you mean by baseline shift? Do you want to change just the axis limits on the plot, or do you mean actually change the data values?
H.
on 7 Feb 2013
Answers (1)
Wayne King
on 7 Feb 2013
Edited: Wayne King
on 7 Feb 2013
You can then just do the following. I'll assume that X is your data in the MATLAB workspace
X = 5+randn(200,1);
Y = X-X(1);
The above code subtracts the value of X at t=0 (the first value) from all elements of the signal. This has the effect that Y (the new signal) is equal to 0 at t=0.
Another way that is better in many contexts is to subtract the overall mean from each element of the signal.
X = 5+randn(200,1);
Y = detrend(X,0);
% OR
Y = X-mean(X);
Categories
Find more on Uniform Distribution (Continuous) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!