How to add AWGN white noise in a 2d vector

8 ビュー (過去 30 日間)
Taimoor
Taimoor 2013 年 10 月 12 日
編集済み: Sean de Wolski 2013 年 10 月 14 日
mixed_ocr is a vector of 350x250. im receiving an error with the following code..please help
CODE :
clc
A1 = load('mixed_ocr.mat');
mixd_ocr = (A1.mixed_ocr);
y = awgn(mixd_ocr,10,'measured');
ERROR:
??? Error using ==> plus
Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> awgn at 272
y = sig+wgn(size(sig,1), size(sig,2), noisePower, 1, state, pMode, opType);
Error in ==> PARTA_Q3 at 4
y = awgn(mixd_ocr,10,'measured');
  1 件のコメント
Nishitha Ayyalapu
Nishitha Ayyalapu 2013 年 10 月 14 日
It works fine with the data I worked on:
A = rand(350,250);
y = awgn(A,10,'measured');
The problem might be in the .mat you loaded. More information on your 350x250 you loaded would help to resolve the error.

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

採用された回答

Wayne King
Wayne King 2013 年 10 月 14 日
編集済み: Wayne King 2013 年 10 月 14 日
I think you should try casting the mixd_ocr matrix to double.
mixd_ocr = double(mixd_ocr);
If you execute
class(mixd_ocr) % before you cast to double
You'll probably see the issue. For example:
X = randn(350,250);
X = int8(X);
y = awgn(X,10,'measured');
gives the same error you are seeing.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePropagation and Channel Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by