Trouble with Envelope Functions

조회 수: 9 (최근 30일)
Si
Si 2015년 4월 21일
댓글: Hany Ferdinando 2019년 1월 29일
Hi,
I have been trying to obtain a smooth envelope of my data. I have tried using other peoples solutions from the file exchange but unable to get a smooth envelope. See attached images.
Attached is the relevant data.
If anyone can recommend a file exchange or other solution would be much appreciated!
Thanks!
  댓글 수: 1
Glo
Glo 2015년 4월 21일
Can you be more specific about your question? What is this data? What do you mean by "smooth envelope"? What is the specific goal?

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

채택된 답변

John D'Errico
John D'Errico 2015년 4월 21일
편집: John D'Errico 2015년 4월 21일
The problem is, you don't really want an envelope.
For example, here are a couple of fits that will produce an envelope.
slm_upper = slmengine(x,y,'env','sup','plot','on','knots',30);
slm_lower = slmengine(x,y,'env','inf','plot','on','knots',30);
Those are envelope fits, i.e., least upper bound and greatest lower bound functions.
But what you have drawn are functions that sort of look like that, but go where you want them to go, ignoring some of your data. So they skip some points that you consider outliers. You want maybe a function that can intelligently (defined by what you consider an outlier) exclude perhaps some 1 to 5% of the points as outliers.
The problem is, the eye is good at seeing a pattern that it likes. The computer, not so good. Computers do what they are programmed to do.
Perhaps the best suggestion I can offer is to use a tool like my SLM as below in a multiple step process:
slm_upper0 = slmengine(x,y,'env','sup','plot','on','knots',30);
tol= max(y)*1.e-14;
res_upper = slmeval(x,slm_upper,0) - y;
keep_upper = find(res_upper > tol);
drop_upper = find(res_upper <= tol);
slm_upper = slmengine(x(keep_upper),y(keep_upper),'env','sup','plot','on','knots',30);
hold on
plot(x(drop_upper),y(drop_upper),'ro')
Thus, find the points that were on the boundary in one envelope, then exclude them form the fit, and repeat the fit. Do a similar procedure for a lower semi-envelope. I'm not sure I see a better way.
The SLM toolbox is on the file exchange.
  댓글 수: 1
Si
Si 2015년 4월 21일
Thanks for your answer very helpful indeed

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

추가 답변 (1개)

Youssef  Khmou
Youssef Khmou 2015년 4월 21일
편집: Youssef Khmou 2015년 4월 21일
try the following basic solution using Hilbert transform :
fs=40;
t=0:1/fs:4-1/fs;
f=15;
y=1.5*sin(2*pi*f*t).*exp(-1.1*t);
y=y+0.1*randn(size(t));
plot(t,y)
hold on;
z=abs(hilbert(y));
plot(t,smooth(z,0.25),'r');
  댓글 수: 2
Si
Si 2015년 4월 21일
Thanks for your answer - much appreciated.
Hany Ferdinando
Hany Ferdinando 2019년 1월 29일
Hi Youssef,
I also faced the same problem using envelop function. However, using your approach seemed not useful for me. The blue line is the PPG signal. The envelope calculation using hilbert seemed not what I expected. What do you think?
Thanks

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

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by