Reputation: 1
(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.
Upvotes: 0
Views: 274