??? Error using ==> mldivide Matrix dimensions must agree.

hy everyone can help me to fix my problem ??
Error in ==> masukan at 18 c = sqrt(sum(s.^2)/sum(b_in.^2));
function [y,b,b_in,s,Fs] = masukan (SNR)
%Masukan sinyal suara dan sinyal derau
[s,Fs] = wavread('suara.wav');
%n =length(s);
b_in = wavread('derau_angin.wav');
%Menghitung faktor normal SNR
c = sqrt(sum(s.^2)./sum(b_in.^2));
b = c * 10^(SNR./20) * b_in;
%Sinyal suara dan derau
y = s + b;
end
thanks for your help

4 Comments

ok.. thanks for your help :)
The error refers to:
c = sqrt(sum(s.^2)/sum(b_in.^2));
You vectorised it in the code you posted:
c = sqrt(sum(s.^2)./sum(b_in.^2));
so I assume matrix division is not the problem, and array sizes are. However, this would be rdivide or mrdivide, so I have no idea what the actual error is.
That aside, apparently, ‘suara.wav’ and ‘derau_angin.wav’ are different lengths (row sizes).
Only you can solve that problem.
thanks star strider for your help :)

Sign in to comment.

Answers (0)

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Tags

Asked:

on 4 Feb 2018

Commented:

on 5 Feb 2018

Community Treasure Hunt

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

Start Hunting!