필터 지우기
필터 지우기

I need to find Y values between two given points.

조회 수: 3 (최근 30일)
Inteeskimo
Inteeskimo 2017년 11월 11일
답변: the cyclist 2017년 11월 11일
I have sets of x coordinates as follows (1527 2127, 2629 3229,...etc)
I need to find the Y values between each set then take all of those values and divide it by the number of sets.
This is an ECG signal and basically, I want to make a new plot which is an average of each cycle.
  댓글 수: 4
the cyclist
the cyclist 2017년 11월 11일
Is x stored in a 10,000 x 2 array? Are the intervals defined by each row of x guaranteed to be disjoint from each other, with no overlap?
Inteeskimo
Inteeskimo 2017년 11월 11일
편집: Inteeskimo 2017년 11월 11일
yes, there is no overlap. and the x values are just time in milliseconds (0 - 10,000) and y is in millivolts. each value of x corresponds with a value of y. I could do this manually by opening the variable and copying and pasting all the values between those sets and averaging them out. the sets are the values 200 and 400 milliseconds before and after each peak respectively.

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2017년 11월 11일
Here is a small-scale example.
x = [1527 2127;
2629 3229;
4131 5555];
y = [2000;
2100;
3000;
3100;
5000];
y3 = reshape(y,1,1,[]);
intervalIndex3 = y3 > x(:,1) & y3 < x(:,2);
[intervalIndex,~,~] = ind2sub([size(x,1) 1 size(y,1)],find(intervalIndex3))
intervalIndex will tell you which row of x the value of y belongs to.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by