Convert White noise added ECG signal into binary

1 回表示 (過去 30 日間)
Kumari Surbhi
Kumari Surbhi 2020 年 4 月 20 日
編集済み: Kumari Surbhi 2020 年 4 月 21 日
Hi,
I am trying to convert an ECG signal into binary format. I have added noise to the ECG signal using awgn function. Now i need to convert this signal to binary format to give as an input to a filter. the commands i have given are,
load('ECG signal name')
plot(val(9,:))
z = awgn(val,0.5);
now z needs to be converted into binary format.
Please help how to do this.
  2 件のコメント
Mehmed Saad
Mehmed Saad 2020 年 4 月 20 日
編集済み: Mehmed Saad 2020 年 4 月 20 日
what is the threshold to convert it to binary?
for example, if greater than threshold 1 otherwise 0
Kumari Surbhi
Kumari Surbhi 2020 年 4 月 21 日
I am not sure threshold value needs to defined. It is simply conversion from fractional decimal to binary conversion. e.g. using de2bi function. But this function only applies to integers.

サインインしてコメントする。

採用された回答

Mehmed Saad
Mehmed Saad 2020 年 4 月 21 日
Load ECG Signal
load('mit200.mat')
Make it all positive
shift_up = min(ecgsig);
ecg_n = ecgsig-shift_up;
Normalize it (0 to 1)
norm_1 = max(ecg_n);
ecg_n = ecg_n/norm_1;
convert it to I32
ecg_i32 = uint32(round(ecg_n*2^32));
Now your signal is converted in u32, you can use de2bi
ecg_b = de2bi(ecg_u32,32);
The signal ecg_b is the binary for of your ecg signal
To convert it back to normal
ecg_d = double(bi2de(ecg_b));
divide it by 2^32
ecg_d = ecg_d/2^32;
Now the signal you ve is normalized between 0 and 1. to convert it to original range
ecg_d = ecg_d*norm_1;
ecg_d = ecg_d+shift_up;
  1 件のコメント
Kumari Surbhi
Kumari Surbhi 2020 年 4 月 21 日
編集済み: Kumari Surbhi 2020 年 4 月 21 日
It is working fine. Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeECG / EKG についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by