I have force-time graph and I want to identify the baseline. How can I do this? Is there a function to find the baseline?

 Réponse acceptée

Star Strider
Star Strider le 31 Mar 2021

0 votes

Since the baseline appears to be the minimum value, the min function may do what you want. There are similar functions that can extend that approach if you need to use them.

9 commentaires

Ibrahim Suleiman
Ibrahim Suleiman le 31 Mar 2021
Why does the baseline seem to be the minimum value? I thought that the baseline is either the trend of the data or the average. Please can you clarify this for me?
Star Strider
Star Strider le 1 Avr 2021
It is can display a non-zero trend with variation, however in the image posted, it appears to be the minimum and constant (actually 0), with no visible variation. To force it to be zero, use a highpass filter with a cutoff of at most 1 Hz to completely remove any non-zero trend that may be present.
Image Analyst
Image Analyst le 1 Avr 2021
@Ibrahim Suleiman rmoutliers() may be useful to you to remove the spikes.
Star Strider
Star Strider le 1 Avr 2021
I was under the impression that the spikes were the signal.
Since we have absolutely no relevant information, or the data, I’m left to wonder.
Image Analyst
Image Analyst le 1 Avr 2021
Well, yeah. So it you remove them what you're left with is the baseline, from which you can smooth it if you want it to vary slightly as a function of position, or just take the mean of the whole baseline if you just want to say it's a constant over the whole range.
Thank you for both of your help. I have used rmoutliers function and I am trying to remove the peaks of the signal from the entire signal to get the baseline but I cant do that because the vectors are not the same length. Here's my code:
Jog=readtable("005jog.csv");
%Extract the time vector and the force vector
%to be the x and y coordinates
x=Jog.Var1;
y=Jog.Var10;
%Extract the outliers(peaks of this signal)
B=rmoutliers(y);
%Finding the baseline but this doesn't work because of different vector
%lengths
Baseline = y - B;
Size(B)= 77218x1 double
Size(y)= 79693x1 double
Can you tell me how to do this subtraction?
The isoutlier function will return a logical vector that can be used on the rows of the table to eliminate the outliers from both variables (and all the others as necessary).
For example, this could work:
Jog = array2table(randn(15, 5)); % Create Table
TF = isoutlier(Jog.Var1, 'percentiles',[15 85]); % Define & Detect Outliers
JogNew = Jog(~TF,:); % Remove Outliers
Experiment to get the result you want.
Ibrahim Suleiman
Ibrahim Suleiman le 23 Avr 2021
Thank you for your help. This aproach makes the most sense to me.
Star Strider
Star Strider le 23 Avr 2021
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 31 Mar 2021

0 votes

Maybe mask the signal to find values below a threshold and then take the mean
threshold = 10; % Or whatever.
baselineIndexes = abs(signal) < threshold;
baseLineValue = mean(signal(baselineIndexes));
yline(baseLineValue, 'Color', 'r', 'LineWidth', 2);

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by