I am trying to filter signal, where data of certain rate oif change is filtered out. I am not able to achieve my goals, for example with lowpass (tried for example lowpass(yTemp, 10, Fs2). below is plot with original signal to be filtered (blue) and with red, I have hand drawn what how I would like to filtered signal to behave. Of course it doesent need to be precisely like drawn, its just for example, to illustrate the point.
data is in attachment (x,y,Fs).
all help is appreciated

 채택된 답변

Mathieu NOE
Mathieu NOE 2025년 2월 6일
편집: Mathieu NOE 2025년 2월 6일

0 개 추천

hello
I was thinking that I could use the "baseline" correction approach, then apply a scale factor on the baseline compensated signal , add some smoothing then put back the base
and this is the result so far :
load('vars.mat')
% option # 1 : obtain the lower envelope data
N = 200;
[up1,down1] = envelope(yTemp,N,'peak');
% now apply smoothing on baseline corrected data and put back the baseline in
yc = yTemp - down1;
yscale_factor = 0.25; % apply only a fraction of yc (baseline corrected signal)
yTemps = smoothdata(yscale_factor*yc,'gaussian',2*N) + down1;
figure
plot(x,yTemp,x,down1,'--',x,yTemps,'linewidth',2)
legend('signal','lower envelope','smoothed');

댓글 수: 5

this is another alternative using the attached function :
% option # 2 : Baseline correction
[Base, yc]=baseline(yTemp(:));
figure
subplot(2,1,1),plot(x,Base,'--',x,yTemp,'linewidth',2)
subplot(2,1,2),plot(x,yc,'linewidth',2)
% now apply smoothing on baseline corrected data and put back the baseline in
N = 300;
yscale_factor = 0.25; % apply only a fraction of yc (baseline corrected signal)
yTemps = smoothdata(yscale_factor*yc,'gaussian',N) + Base;
figure
plot(x,yTemp,x,yTemps,'linewidth',2)
legend('signal','smoothed');
Sven Larsen
Sven Larsen 2025년 2월 6일
Thank you so much, this was precisewly what I was looking for. Both solutions are very good and it may be, I need to use lower envelope instead of smoothed.
Again, thanks! Will learn envelope and smoothdata, so I can use these also in future
Mathieu NOE
Mathieu NOE 2025년 2월 6일
my pleasure ! glad I could help
what is peak_stripping in your line:
[Baseline, stripping]=peak_stripping(S,n);
Mathieu NOE
Mathieu NOE 2025년 2월 7일
sorry, forgot to give you that function too
see attached :)

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

추가 답변 (0개)

카테고리

제품

질문:

2025년 2월 6일

댓글:

2025년 2월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by