使用 Matlab 获取信号的包络

发布于 2025-01-10 00:44:40 字数 1097 浏览 3 评论 0原文

(提前告诉我,我是 Matlab 的绝对初学者)。

我在使用 Matlab 中的信封函数时遇到问题。 我的目标是获得信号的上下包络,以便获得信号随时间变化的长度。我尝试使用Matlab中已经集成的信封函数,但看起来我没有得到什么。

我使用的数据取自一个 txt 文件,如下所示。

信号 信号的txt

我尝试复制现有程序,但我认为我还没有理解完美。 这是我启发自己制作这个程序的代码。

clc;
%Extraction des données du fichier
load signal.txt signal;
t = signal(:,1); % Abscisse : temps (s)
y = signal(:,2); % Ordonnée : pression (mmHg)

%Tracé du signal original
figure(1);
plot(t,y,'b-'); 
title('Signal à analyser','FontSize',18);

%Extraction de l'enveloppe
[up,down] = envelope(t,y,'linear');

%tracé de l'enveloppe
figure(2)
plot(t,up); hold on;
plot(t,down);
title('Enveloppe du signal','FontSize',18);
hold off;

该代码适用于程序中包含的文件“数据”,但不适用于我的。 它所使用的文件“数据”

使用我的信号,它显示以下错误: 我的信号数据出现的错误 我给你我写的代码,让你更容易理解我的错误是什么。

提前感谢您的帮助。

(person me in advance, I'm an absolute beginner in Matlab).

I have an issue using the envelope fonction in Matlab.
My goal is to get the up and down envelope of a signal, in order to have the length of the variation of my signal, in function of the time. I tried to use the envelope function already integrated in Matlab, but it looks like I don't get something.

The data I'm using is taken from a txt file which look like this.

Signal
txt of the signal

I tried to copy an existing program but I think that I haven't understood it perfectly.
Here is the code I have inspired myself to make this program.

clc;
%Extraction des données du fichier
load signal.txt signal;
t = signal(:,1); % Abscisse : temps (s)
y = signal(:,2); % Ordonnée : pression (mmHg)

%Tracé du signal original
figure(1);
plot(t,y,'b-'); 
title('Signal à analyser','FontSize',18);

%Extraction de l'enveloppe
[up,down] = envelope(t,y,'linear');

%tracé de l'enveloppe
figure(2)
plot(t,up); hold on;
plot(t,down);
title('Enveloppe du signal','FontSize',18);
hold off;

This code is working for a file "data" included with the program, but doesn't work with mine.
The file "data" it works with

With my signal, it shows the following error :
The error I get with the data of my signal
I give you the code I wrote, to make it easier to you to understand what my mistake is.

Thanks for your help in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文