An error at modulation process

[sound,fs]=wavread('sesdeneme.wav');
fn1 = [10/(7000), 700/(7000)];
[b1,a1] = butter(10, fn1, 'bandpass');
y1=filter(b1, a1, sound);
envelope1 = abs(hilbert(y1));
t=0:0.001:1;
car1=5*cos(2.*pi.*350.*t);
mod1=envelope1.*car1;
plot(t,mod1);grid on
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
i am trying to product envelope1 and car1 but i get this error:
??? Error using ==> times
Matrix dimensions must agree.
Error in ==> implantsonhali at 60
mod1=envelope1.*car1;
Can anyone please help me? :) ty

 채택된 답변

Wayne King
Wayne King 2012년 4월 8일

0 개 추천

You must not be executing this line
sound = sound(:,1);
sound must be 118784x1, NOT 118784x2
clear everything in your workspace
>>clear all
Then
[sound,fs]=wavread('sesdeneme.wav');
sound = sound(:,1);
fn1 = [10/(7000), 700/(7000)];
[b1,a1] = butter(10, fn1, 'bandpass');
y1=filter(b1, a1, sound);
envelope1 = abs(hilbert(y1));
t=0:1/fs:(length(y1)*1/fs)-1/fs;
car1=(5*cos(2.*pi.*350.*t))';
mod1=envelope1.*car1;
fn2 = [700/(7000), 1500/(7000)];
[b2,a2] = butter(10, fn2, 'bandpass');
y2=filter(b2, a2, sound);
envelope2 = abs(hilbert(y2));
mod2=envelope2.*car1;
plot(t,mod1);grid on,figure;plot(t,mod2);grid on
Just copy and paste what I have given you. After you clear everything.

추가 답변 (10개)

Wayne King
Wayne King 2012년 4월 8일

1 개 추천

You have a two-channel recording, do this:
[sound,fs]=wavread('sesdeneme.wav');
sound = sound(:,1);
fn1 = [10/(7000), 700/(7000)];
[b1,a1] = butter(10, fn1, 'bandpass');
y1=filter(b1, a1, sound);
envelope1 = abs(hilbert(y1));
t=0:1/fs:(length(y1)*1/fs)-1/fs;
car1=(5*cos(2.*pi.*350.*t))';
mod1=envelope1.*car1;
plot(t,mod1);grid on
Honglei Chen
Honglei Chen 2012년 4월 7일

0 개 추천

It seems taht your evelope1 is derived from the input sound, while your car1 has the dimension of t, so the two don't match in size.
emre
emre 2012년 4월 8일

0 개 추천

thank you,but how can i solve this problem,any ideas?
Wayne King
Wayne King 2012년 4월 8일

0 개 추천

[sound,fs]=wavread('sesdeneme.wav');
fn1 = [10/(7000), 700/(7000)];
[b1,a1] = butter(10, fn1, 'bandpass');
y1=filter(b1, a1, sound);
envelope1 = abs(hilbert(y1));
t=0:1/fs:(length(y1)*1/fs)-1/fs;
if iscolumn(envelope1)
t = t(:);
end
car1=5*cos(2.*pi.*350.*t);
mod1=envelope1.*car1;
plot(t,mod1);grid on
emre
emre 2012년 4월 8일

0 개 추천

thx Wayne but now i get this error:
??? Undefined function or method 'iscolumn' for input arguments of type 'double'.
Wayne King
Wayne King 2012년 4월 8일

0 개 추천

You must not have a version with iscolumn(). That's fine, you don't need that, I just put that in in case the output of filter() is a column vector.
Just make sure that car1 and envelope1 are both row or column vectors
Enter
>>whos envelope1
if it is column vector, then use
t = t(:);
and you'll be fine.
emre
emre 2012년 4월 8일

0 개 추천

sorry again,when i type it i get this:
Name Size Bytes Class Attributes
envelope1 118784x2 1900544 double
i couldnt understand if it is column or row vector so i tried writing t=t(:); but i get same matrix dimension error.
Tried not to write anything,but still get the dimension error :(
emre
emre 2012년 4월 8일

0 개 추천

thank you Wayne,this is really working but,ş have a last question
when i try to do this more than once,i get the dimension error again.i mean:
[sound,fs]=wavread('sesdeneme.wav');
sound = sound(:,1);
fn1 = [10/(7000), 700/(7000)];
[b1,a1] = butter(10, fn1, 'bandpass');
y1=filter(b1, a1, sound);
envelope1 = abs(hilbert(y1));
t=0:1/fs:(length(y1)*1/fs)-1/fs;
car1=(5*cos(2.*pi.*350.*t))';
mod1=envelope1.*car1;
fn2 = [700/(7000), 1500/(7000)];
[b2,a2] = butter(10, fn2, 'bandpass');
y2=filter(b2, a2, sound);
envelope2 = abs(hilbert(y2));
t=0:1/fs:(length(y2)*1/fs)-1/fs;
car2=(5*cos(2.*pi.*350.*t))';
mod2=envelope2.*car2;
plot(t,mod1);grid on,figure;plot(t,mod2);grid on
same error agian when i do this :(

댓글 수: 1

Wayne King
Wayne King 2012년 4월 8일
tell me what
>>whos y1
>>whos y2
>>whos car1
gives

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

emre
emre 2012년 4월 8일

0 개 추천

Name Size Bytes Class Attributes
y1 118784x2 1900544 double
Name Size Bytes Class Attributes
y2 118784x2 1900544 double
Name Size Bytes Class Attributes
car1 118784x1 950272 double
I can give my original code if you want.i am writing there summary of it but maybe i am missing smt.
emre
emre 2012년 4월 8일

0 개 추천

thx for all :)

카테고리

질문:

2012년 4월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by