How to know the abscissa of these y values?

10 次查看(过去 30 天)
Hello, I have an EDA signal, in column 6 of a text file (signal.txt), and I want to calculate the amplitude (y) (maximum-minimum) and the rise time (x),i.e., the time from minimum to maximum, but the script that I have doesn't work.
This is what I have, and the error in tmim and tmax that is showed is "The indexes of the matrix must be positive integers or logical values".
I hope you can help me, thank you very much!
data_org = importdata('signal.txt,'\t',7); %text file with 7 columns
EDA=data_org.data;
EDA= EDA(:,6); %I only want the values of the 6 collumn
EDAuS=((EDA/2^10)*3)/0.12; %convert to uS
N= length(EDAuS);
fs = 1000;
T=N/fs;
t = (0:N-1)/fs;
f = (0:N-1)/T;
[b,a] = butter(6,0.0035,'low');
EDAuS_filter = filtfilt(b,a,EDAuS); %filtering signal EDA
minimum= min(EDAuS_filter);
maximum= max(EDAuS_filter);
amp=maximum-minimum; %amplitude
tmin=t(minimum);
tmax=t(maximum);
rise_time= tmax-tmin;

回答(2 个)

Image Analyst
Image Analyst 2020-5-7
Probably our most faqqy of the FAQs. See the FAQ for a thorough discussion:

Star Strider
Star Strider 2020-5-7
You have a series of 16-element frames, each with columns 6 and 7 being a series of pulses.
Filtering them is likely not appropriate, because it obscures the details. Besides, I got the impression we already solved this problem(?)
Try this:
data_org = importdata('signal.txt');
D=data_org.data;
fullend = find(D(:,1) == 15, 1,'last');
Dr = reshape(D(1:fullend,[1 6 7])', 3, 16, []);
Dr = permute(Dr,[2,1,3]);
for k = 1:size(Dr,3)
frame = Dr(:,:,k);
t = frame(:,1);
EDA = frame(:,6);
% — ANALYSE THE SIGNAL IN THIS FRAME —
% — SAVE THE RESULTS TO THE APPROPRIATE CELL ARRAYS —
end
We did something similar to this with your previous files in your other Question.
Use whatever related Signal Processing Toolbox functions you need to use to analyse your signals.

Community Treasure Hunt

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

Start Hunting!

Translated by