Spline function to detect zero crossing

Hi All,
I was hoping someone might be able to help me, I am not very good with Matlab so I apologise if this is a stupid question.
I have a series of data that changes over time from being negative to positive. I would like to detect the point at which the data crosses zero. I believe the best way to do this is using a spline curve but I am not sure how to write the routine. Can anyone help me please?!
Thanks
Mel

답변 (2개)

Star Strider
Star Strider 2014년 3월 21일

0 개 추천

Not a spline, but my answer to Fast zero-crossings with interpolation seems to work reasonably well. I can probably modify it to work with your data, but I have to know what your data are.

댓글 수: 6

Melitta
Melitta 2014년 3월 24일
Thank you for your reply.
My data are in two columns. On the y axis is a ratio and on the x axis is a continuous variable (in this instance % total power output). I could send you a file if that would help?
Star Strider
Star Strider 2014년 3월 24일
That would help. Attach the file to your original post. I’ll check back here from time to time. (I would prefer a ‘.txt’ file rather than a spreadsheet page.)
Melitta
Melitta 2014년 3월 24일
Thank you so much! I have attached the txt file. I am trying to plot column C on the y axis as a function of column A on the x-axis and run a routine that allows me to mathematically determine at what value on the x-axis the data cross 0.
I hope that makes vague sense....
Thank you again.
I thought the data were going to be a relatively continuous (if noisy) line. It’s instead a scattergram. It’s probably possible to fit a function to it if you want, but if you simply want to know the values of X (Column 1) are for Y (Column 3) less than zero, that’s easy:
xylz = V((V(:,3)<0),1); % X-values for Y < 0
yylz = V((V(:,3)<0),3); % Y-values for Y < 0
Using the find function is also an option.
Melitta
Melitta 2014년 3월 25일
What does V represent in the above function? Sadly this is as clean and continuous as physiological data get!
Thank you for your help
Star Strider
Star Strider 2014년 3월 25일
편집: Star Strider 2014년 3월 25일
I labeled your data as matrix V after eliminating all the ‘DIV/0!’ entries, and the last couple lines that didn’t make sense to me. I should have explained that.
I have a robust background in physiology and physiological measurement from both basic science and clinical perspectives, so I did my best to make sense of your data. Unfortunately, I couldn’t. I didn’t see any obvious relationship.
I assume VO2 is oxygen consumption, and Hb is haemoglobin, but I’m not sure what HHb and HHb.VO2 are. If HHb.VO2 is (HHb x VO2), I strongly suggest you not regress it against VO2, since it’s correlated with VO2 by the way you have defined it. The results will be meaningless.

댓글을 달려면 로그인하십시오.

Matt J
Matt J 2014년 3월 24일

0 개 추천

The Curve Fitting Toolbox gives lots of different functions for fitting splines to your data
You could then use FNZEROS to find their zero crossings.

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

질문:

2014년 3월 21일

편집:

2014년 3월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by