필터 지우기
필터 지우기

Multiplication of sound and sinusoidal signal

조회 수: 6 (최근 30일)
ali okumus
ali okumus 2018년 12월 18일
댓글: Oswaldo Colin Martinez 2020년 11월 26일
clc;
[a,Fs]=audioread("music.wav");
%sound(a,Fs);
si=size(a);
t=si/Fs;
t2=0:1/Fs:1;
f=15000;
signal=sin(2*pi*f*t2);
A=a';
K=A*signal;
When i try to multply i got an error . idont know what to do ?
  댓글 수: 1
Jan
Jan 2018년 12월 18일
If you get an error message and want the forum to help you, it is useful to post a copy of the complete message. It is easier to solve a problem than to guess, what the problem is.
Note that size(a) replies a vector. This is not a problem here, because t is not used anywhere.

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

채택된 답변

Omer Yasin Birey
Omer Yasin Birey 2018년 12월 18일
편집: Omer Yasin Birey 2018년 12월 18일
The problem here is you take the t2 until 1 second, when your sound lasts more (or less) than 1 second
t2=0:1/Fs:1;
However it must last until the duration not until 1. Therefore, change this line with
t2=0:1/Fs:duration;
And also I believe you want to do element wise multiplication so put a dot before the multiplication sign.
clc;
[a,Fs]=audioread('music.wav');
duration = length(a)./Fs;
si=size(a);
t=si/Fs;
t2=0:1/Fs:duration-1/Fs;
f=15000;
signal=sin(2*pi*f*t2);
A=a';
K=A.*signal;
  댓글 수: 1
ali okumus
ali okumus 2018년 12월 18일
Thank you very much .I really appreciated your help .it worked for me .

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

추가 답변 (2개)

Jan
Jan 2018년 12월 18일
편집: Jan 2018년 12월 18일
I guess, you want this:
[a, Fs] = audioread('music.wav');
len = size(a, 1);
t = (0:len - 1) / FS; % time in seconds
freq = 15000;
signal = sin(2 * pi * freq * t);
result = a .* signal.';
This multiplies even stereo signals, but you need >= R2016b for the auto-expanding. Please ask, if you use an older Matlab version.
  댓글 수: 1
Oswaldo Colin Martinez
Oswaldo Colin Martinez 2020년 11월 26일
Thankyou! After a few years, this post has saved me.

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


ali okumus
ali okumus 2018년 12월 18일
Dear friends
I really appreciate your concerns .i got my problem solved. thank you .

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by