現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
Average of Wave from 10 waves in single graph
17 ビュー (過去 30 日間)
古いコメントを表示
Hello Everyone,
I have a doubt concerning the average of the wave from a set of waves from sinlge dataset. I need to get a single average curve from all the curves from the figure. I am new to matlab and can not figure it out and have not been able
to do so for a long time. I need you to help and it would be great for me. Thanks in advance.
![Screenshot (6) .png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249262/Screenshot%20(6)%20.png)
3 件のコメント
Jan
2019 年 11 月 20 日
Please calm down. Posting a question twice will confuse the ones who want to help you and maybe waste their time, when they type an answer, which has been given already. Therefore I have cleaned up your identical former question.
You cannot expect the voluntary helpers to post an answer in some minutes. Mentioning, that the problem is "urgent" is counterproductive. See: https://www.mathworks.com/matlabcentral/answers/29922-why-your-question-is-not-urgent-or-an-emergency
There is only one curve in the image, so asking for an average is not meaningful. I guess, you mean that te curve is almost periodic and you want an average period. Then please explain, what the inputs are. It is easier to suggest a matching code, if we do not guess tis detail.
Lokeswara reddy pamulapate
2019 年 11 月 20 日
I have the data attched to this. Actually it is the wave of radial artery bloop pressure wave. I want to take the average of all the data to get one average curve from those data.
採用された回答
Star Strider
2019 年 11 月 20 日
Try this:
D = load('P_191005_000.mat');
ap = D.b;
Ts = 1E-3; % Assume Sampling Interval
tv = linspace(0, 1, numel(ap))*Ts; % Create Time Vector
[pks, locs] = findpeaks(-ap, 'MinPeakDist',250, 'MinPeakHeight',-85 ); % Determine Peaks & Indices
figure(1)
plot(tv, ap)
hold on
plot(tv(locs), -pks, '+r')
hold off
grid
for k1 = 1:numel(locs)-1
apc{k1} = ap(locs(k1):locs(k1+1)); % Define Frames
tvc{k1} = tv(locs(k1):locs(k1+1));
len(k1) = numel(locs(k1):locs(k1+1));
end
enstrim = cellfun(@(x)x(1:min(len)), apc, 'Uni',0); % Trim Records To Shortest Length
ensavg = mean([enstrim{:}],2); % Ensemble Average
figure(2)
hold all
for k1 = 1:numel(apc)
plot(tvc{k1}-tvc{k1}(1), apc{k1}) % Plot Frames
end
plot(tv(1:numel(ensavg)), ensavg.', '-r', 'LineWidth',2)
hold off
grid
producing:
![Average of Wave from 10 waves in single graph - 2019 11 20.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249292/Average%20of%20Wave%20from%2010%20waves%20in%20single%20graph%20-%202019%2011%2020.png)
31 件のコメント
Jan
2019 年 11 月 20 日
+1. Id change this detail:
len(k1) = numel(locs(k1):locs(k1+1));
to:
len(k1) = locs(k1+1) - locs(k1) + 1;
or even outside the loop:
len = cellfun('length', tvc);
Lokeswara reddy pamulapate
2019 年 11 月 20 日
ThankYou very much. It's working.
I am really thankful to you.
Lokeswara reddy pamulapate
2019 年 11 月 22 日
Hi I have data of aorata, in which I want to remove the noise and identify the pe
aks and interference. After that I want to separate the each cycles
from starting point of peak to the end of the peak for total signal present.
Can you please
help me how to proceed on.
![Screenshot (10).png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249570/Screenshot%20(10).png)
Thank you very much for your time.
Star Strider
2019 年 11 月 22 日
I can clean that up to an extent, however you need to do the rest of the processing, then use my posted code to do the ensemble averages. You will need to make some choices as to what constitutes valid data, and correct for what appears to me to be significant arrhythmias. The arrythmias are going to make it very difficult to do a reliable ensemble average.
Preprocessing —
D = load('16Zi239231227Z11201Z0Z0Z0');
sig = D.column1(:,1);
Fs = 1;
Ts = 1/Fs;
Fn = Fs/2;
L = size(sig,1);
sigm = sig - mean(sig);
FTsig = fft(sigm)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTsig(Iv))*2)
grid
xlim([0 0.025])
siglpf = lowpass(sig, 0.003, Fs); % Lowpass Filter
[pks1,locs1] = findpeaks(siglpf, 'MinPeakHeight',100, 'MinPeakDistance',250);
[pks2,locs2] = findpeaks(siglpf, 'MinPeakHeight',170);
pks = setdiff(pks1,pks2);
locs = setdiff(locs1,locs2);
tv = 0:(L-1); % Time Vector
figure
plot(tv, siglpf)
hold on
plot(tv(locs), siglpf(locs), '+r')
hold off
grid
xlim([locs(1) L])
To eliminate the leading zero values and transients, select the signal as ‘((locs(1)-100):end)’. Lacking a true time vector of sampling times means that you can only get approximate statistics.
To see a representative sample of the filtered signal, use this xlim call:
xlim([locs(1)-100 locs(10)+160])
The filter passband appears to be appropriate, so there is no need to change it.
Experiment to get different results.
Lokeswara reddy pamulapate
2019 年 11 月 22 日
Ya it is working, with it. I will clean the rest and how can we divide the each wavefrom starting of the peak to the end of the peak in total signal.
I am really thankfull to you.
Lokeswara reddy pamulapate
2019 年 11 月 23 日
Caan you please help me with: how to seperate each curve in the signal. I want to seperate the each signals in the total output. This is my final research in my university please can you help me. I am learning matlab and dont have time for my research I should submit by this month end. Please help me with this cleaning the data and seperating the each curve. I have around 500 patients to carry out with this data. Please help me with some code.
Jan
2019 年 11 月 23 日
@Lokeswara reddy pamulapate: This is the final research project for your university and you do not have time to process the data? Now you want the forum to solve your work? Sorry, this sounds disappointing.
I suggest to use Star Strider's code.
Star Strider
2019 年 11 月 23 日
@Lokeswara reddy pamulapate — I looked at those files when you posted them in your other Question. They are so corrupted with noise that I could not recover them with a frequency-selective filter.
@Jan — Thank you!
Lokeswara reddy pamulapate
2019 年 11 月 25 日
How can we do that any examples? It is too tough to get the outputs please let me know.
Thank you
Lokeswara reddy pamulapate
2019 年 11 月 25 日
@Jan - I was asking for help beacuse I dontknow Matlab and till now I was doing it with machine learning my univeristy said I have to carry out this in Matlab beacuse of patients data. Beacuse of that issue I was asking to help me. Please try to understand.
Lokeswara reddy pamulapate
2019 年 11 月 25 日
@Star Strider Please help me how to proceed on. I really need your help. Please understand my situation. after this step i need to go on with biomarkers and correlate the models I have and implement it in Machine learning.
It would be graet and it means a lot to me with your help and suggetions.
Thankyou very much for you help.
Star Strider
2019 年 11 月 25 日
@Lokeswara reddy pamulapate — I wish I could. You may need to consult with signal processing professors at your university to see if they have any ideas on how best to extract useful information from your signals.
Unlike the file you initially presented here, there is nothing in these files that look to me like a pulse waveform. (I am a Board Certified Internal Medicine physician and biomedical engineer, and I cannot figure out a way to salvage those data.)
You may need to look very carefuly at your instrumentation, since that is quite likely at least part of the problem (and perhaps the entire problem), then repeat those studies.
(Parenthetically, in your original radial pulse waveform, I do not see a dicrotic notch. It should be present, since it is present in fingertip pulse plethysmograms of healthy individuals. It would appear that the subject as aortic insufficiency.)
Lokeswara reddy pamulapate
2019 年 11 月 25 日
編集済み: Lokeswara reddy pamulapate
2019 年 11 月 25 日
It is aorata wave data. It is not radial artery data. those data are collected with other sensors, because of that the data not proper. Can you tell what chenges should I make in the code povided by you to get good results.
Star Strider
2019 年 11 月 25 日
I remember thet the new data are aortic waveforms and the initial data were radial artery waveforms. The radial artery waveforms appeared to be correct, although the pressures may require checking.
The problem is that there is something wrong with the aorta data, and I cannot figure out what the problem is. Something in the instrumentation is creating unusable data, whether it is bubbles in the transducer or problems with the catheter, or something else. If you know what the problem is, there might be a way to salvage the correct waveforms from those data, however in the absence of that information, there is not. The amplitudes are also suspicious. You will most likely have to abandon those data if you cannot figure out what the problem is so that some method of recovering the correct waveforms is possible. The aorta data are currently unusable.
When you collect new data, first be absolutely certain that the entire system is bubble-free, that the transducers are correctly calibrated and in the correct position relative to the subject, and that you have at least one recording of an impulse and step or square-wave input with the recorded inputs and outputs. This will allow you to correct for any nonlinearities and other problems in the physiological data you collect. It may also be necessary to put diluted heparin in the catheter fluid to prevent the catheter tip from clotting.
Lokeswara reddy pamulapate
2019 年 11 月 25 日
編集済み: Lokeswara reddy pamulapate
2019 年 11 月 26 日
when calling the fuction of BP_annotate.m
I am getting these error can anyone help me?
using the function of BP_annotate how can I use this function in
- 16Zi239231227Z11201Z0Z0Z0.mat file
Thanks in advance
>> BP_annotate
Annotating blood pressure...
Not enough input arguments.
Error in BP_annotate (line 75)
inWaveform = inWaveform(:);
Star Strider
2019 年 11 月 26 日
You have not shown your code that calls ‘BP_annotate.m’.
In the files you have posted thus far, there were never any corresponding time vectors that would permit plotting the signals as functions of time, and from which the sampling interval could be computed and the sampling frequency could be estimated. I suspect you are not providing ‘inFs’ to ‘BP_annotate’ either.
Lokeswara reddy pamulapate
2019 年 11 月 27 日
The code you have provided previously uses low pass filter can we try with bandpass filter
Star Strider
2019 年 11 月 27 日
Yes.
Change the lowpass call to bandpass, and provide the lower and upper passband frequencies. See the documentation on bandpass for details. Use the Fourier transform in figure(1):
figure
plot(Fv, abs(FTsig(Iv))*2)
grid
xlim([0 0.025])
to select your frequencies of interest for the filter. (Change the xlim limits as necessary to view the appropriate range. I woukd keep it in the code because it allows you to ‘zoom’ in on an appropriate range of frequencies.)
Lokeswara reddy pamulapate
2019 年 12 月 9 日
@Star Strider I have data of aorta signals of patients in which I have to remove the noise which is present in the middle of the signals. I want a clean signal in which I should identify systolic peaks, diastolic peaks and so on (for this I have a function to identify). Can anyone help me out to remove or delete permanently the noise from the existing signal? I want to remove the gaps in the signal and there are some huge peaks lines that I want to remove as well.
Thank you for your help and your time.
I appreciate the help.
Please help me
P
lease
![Screenshot (38).png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/253593/Screenshot%20(38).png)
Lokeswara reddy pamulapate
2019 年 12 月 10 日
Please help me I could not figure it out how to move on from here. I am trying many codes and could not find out the solution. I used fft on my data but it is not showing the mirror image also. I am strucked and tried many ways but could not figure it out. Please help me to find the solution. As you are some experts in matlab you can help me to find solution which will help me a lot.
Thankyou.
Star Strider
2019 年 12 月 11 日
This shouldl get you started:
D = load('2023Zi1410Zi2520112201227Z11201Z0Z0Z0.mat');
Ao = D.x;
t = linspace(0, numel(Ao), numel(Ao));
[Syspks,Syslocs] = findpeaks(Ao, 'MinPeakDistance', 150, 'MinPeakHeight',150); % Systolic Peak
[Dcntch,Dcnlocs] = findpeaks(-Ao, 'MinPeakDistance', 50, 'MinPeakHeight',-150); % Dicrotic Notch
[Dispks,Dislocs] = findpeaks(-Ao, 'MinPeakDistance', 150, 'MinPeakHeight',0); % Systolic Peak
Dcnlocs = Dcnlocs(Ao(Dcnlocs)>0);
figure
plot(t, Ao)
hold on
plot(t(Syslocs), Syspks, '^r')
plot(t(Dcnlocs), Ao(Dcnlocs), 'vg')
plot(t(Dislocs), Ao(Dislocs), 'vk')
hold off
grid
xlim([0 5000])
legend('Trace','Systolic Peaks', 'Dicrotic Notch', 'Diastolic Nadir', 'Location','best')
I identified and plotted the systolic peak, the dicrotic notch, and the diastolic trough for the first 5000 sampling points in this code. That will not work for the entire trace, since the pulse pressure appears to change significantly after the intial 60K samples, and the trace is also discontinuous.
The signal is actually not very noisy, as this Fourier transform demonstrates:
L = numel(Ao);
Fs = 1;
Fn = Fs/2;
Aom = Ao - mean(Ao);
FTAo = fft(Ao)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTAo(Iv))*2)
grid
xlim([0 0.0001])
I must defer to you to deal with the discontinuities. This is not a reliable trace because of the discontinuities and the wide variation in the absolute pressures and the pulse pressure, so any inferences you get from it are likely to be unreliable.
Lokeswara reddy pamulapate
2019 年 12 月 11 日
編集済み: Lokeswara reddy pamulapate
2019 年 12 月 11 日
@Star Strider I am really very thankfull to you. For identifying the systolic peaks and diastolic peaks I have a function and is working perfectly. The code which you have provided is working as well but not for entire signal as you told. The main problem is to delete the noise which is present in the signal. I have tried to delete the noise by my self by looking where the noise is by zooming it manually and deleting the noise manually but it is taking too much time to clean approx 3hrs per signal. Do I need to delete it manually by looking where the noise is to get the good signal with out any noise. If there is any code that could help me to delete the noise that would save so much of time. Just I need to remove the noise in the signal to get good signal wihich are sutable for detecting the peaks and notch. I have attached the signal which I have cleaned manually, but in this signal also there is a bit noise which I have to delete furthur. if there is any code for deleteing the entire noise of signal for the signal provided before that would help me.
I am really tankfull to you.
Thankyou very much.
Star Strider
2019 年 12 月 11 日
There is not much noise.
I would use:
Ao = lowpass(Ao, 0.007, Fs);
or:
Fs = 1; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = 0.007/Fn; % Stopband Frequency (Normalised)
Ws = 1.2*Wp; % Passband Frequency (Normalised)
Rp = 1; % Passband Ripple
Rs = 60; % Passband Ripple (Attenuation)
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Elliptic Order Calculation
[z,p,k] = ellip(n,Rp,Rs,Wp,'low'); % Elliptic Filter Design: Zero-Pole-Gain
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^18, Fs) % Filter Bode Plot
set(subplot(2,1,1), 'XLim',[0 Fs/5]) % Optional
set(subplot(2,1,2), 'XLim',[0 Fs/5]) % Optional
Ao_filt = filtfilt(sos, g, Ao); % Filter Signal
Both work, and eliminate some of the high-frequency components of the signal. (You need to decide if this is acceptable, since they could eliminate some data that would allow you to characterise the frequency response if the vascular system.)
As for the discontinuities, you need to decide how to deal with those. Records that have such significant discontinuities may not be acceptable data. There are other problems with the signals, as well, especially with regard to the step changes in absolute pressure and pulse pressure. This may be due to amplifier gain changes or other changes in the instrumentation, something that is definitely not advisable during a recording.
Lokeswara reddy pamulapate
2020 年 2 月 8 日
@Star Strider I have a doubt, can you please help me.
I have the data of Aorta and femoral signal in which I have to measure the systolic peak, diastolic peak, foot index, augmentation pressure and time. I identified the systolic peak, diastolic peak, foot index, notch index, and time by doing the 2nd derivative. As the signal is Aorta and femoral it will have a reflection in the pulse wave so I need to measure from these the augmentation pressure, from the systolic peak. I need just the idea how to measure the augmentation pressure of both Aorta and femoral how to identify the augmentation pressure(AP) and pulse pressure (PP) points in the data I have, for both feomral and aorta. please help me for only one step my work would be finished. this is for aorta the picture i have attached. If i identify the systolic peak, augmentation pressure point and pulse pressure point my work would be finished by this please help me. I can see no one better than you to help me. Please help me. Thankyou. Have a good day.
![Augmentation pressure.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270530/Augmentation%20pressure.png)
Lokeswara reddy pamulapate
2020 年 2 月 16 日
@Star Strider please can you help me with this? how to calculate the augmented pressure.
Star Strider
2020 年 2 月 19 日
The pulse pressure is the difference between the systolic and diastolic values, so that is straightforward to calculate. There is no distinct dicrotic notch in the aortic trace (this is worrison=me, since it likely indicates aortic insufficiency), and certainly none in the femoral trace. Since it defines one of the parameters you are interested in, find that point, then find the pressure that corresponds to it. You might be able to identify it in the aortic trace by using the gradient function and looking for changes in the derivative, however it does not exist in the femoral trace.
Lokeswara reddy pamulapate
2020 年 2 月 19 日
Hi, the pulse pressure can be calculated but I need to calculate the Augmented pressure(Anacrotic notch). from these Aorta and femoral.
Star Strider
2020 年 2 月 19 日
For each pulse, identify the dicrotic notch (that appears to define it), as a point in time using the derivative (or whatever technique you choose), then get the pressure at that point in time.
その他の回答 (1 件)
KALYAN ACHARJYA
2019 年 11 月 20 日
編集済み: KALYAN ACHARJYA
2019 年 11 月 20 日
Lets say wave are y1,y2,y3.....up to y10..assuming all are having in same x scale
aveg_data=(y1+y2+y3...+y10)/10;
plot(x,aveg_data)
5 件のコメント
Lokeswara reddy pamulapate
2019 年 11 月 20 日
I need to get only one single wave which is the average of all these waves. I have tried this but I am actually getting the same. Its reducing the Y-axis. I have 4000 rows wth 1 column.
![Screenshot (8).png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249277/Screenshot%20(8).png)
KALYAN ACHARJYA
2019 年 11 月 20 日
Yes aveg_data gives the average of all waves, just read the wave data and do averaging as mentioned
Lokeswara reddy pamulapate
2019 年 11 月 20 日
編集済み: Lokeswara reddy pamulapate
2019 年 11 月 20 日
actuall it is madical data of patients. its radial artery blood pressure. i have alredy attched the data above. I tried what you said but its is giving a whole average number. But I need the average graph of those in a single graph(curve).
KALYAN ACHARJYA
2019 年 11 月 20 日
編集済み: KALYAN ACHARJYA
2019 年 11 月 20 日
Can you share two sample data, so that I can test on it?
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)