使用 Matlab 获取信号的包络
(提前告诉我,我是 Matlab 的绝对初学者)。
我在使用 Matlab 中的信封函数时遇到问题。 我的目标是获得信号的上下包络,以便获得信号随时间变化的长度。我尝试使用Matlab中已经集成的信封函数,但看起来我没有得到什么。
我使用的数据取自一个 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.
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论