Problem with function envelope
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a problem with function envelope. It worked for all my set of data but, in one case, it didn't. When a function become constant, the envelope "goes away", creating a sort of asymptote. Or better, I think that it works, but when the function become constant I have to change stategy or stop the envelope.
I put there a right plot, without envelope, and the plot in which I get this problem.


I use this code, for example:
[low_dMRe, up_dMRe] = envelope(Int_dMRe_20,3000,'peak');
Could anyone help me, please?
Thank you in advance
Chiara
采纳的回答
Star Strider
2022-7-15
The transition in the signal baselline is confusing envelope. It may be necessary to change the ‘np’ value, possibly to a lower number. I can reproduce the behaviour you’re seeing with different values, however with other values it comes close to behaving as expected. It will probably be necessary to just eliminate the envelope value above a specific time.
x = linspace(0, 10, 500);
y = exp(-1.25*x) .* sin(2*pi*x*4.5) + (1-exp(-0.5*x));
[envhi,envlo] = envelope(y, 46, 'peak');
figure
plot(x, y)
hold on
patch([x flip(x)], [envhi flip(envlo)], 'g', 'FaceAlpha',0.5, 'EdgeColor','none')
hold off
grid
title('Original')
ylim([-1 1.5])
Lv = envlo < y; % Plot 'envelope' Only When 'envlo' Is Less Than The Signal
figure
plot(x, y)
hold on
% plot(x, envhi, '-r')
patch([x(Lv) flip(x(Lv))], [envhi(Lv) flip(envlo(Lv))], 'g', 'FaceAlpha',0.5, 'EdgeColor','none')
hold off
grid
title('Limited')
ylim([-1 1.5])
Something like this should also work for your signal.
.
5 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



