Need help troubleshooting MatLab error
이전 댓글 표시
I need help troubleshooting this error message,
Matrix dimensions must agree.
Error in myExperimentThreeLab6 (line 38) Error1 = y ./ x2;
function myExperimentThreeLab6(~)
load handel.mat y;
%sound(y,8192);
% Experiment Three
subplot(4,1,1);
stem(y(100:18000));
title('Original Signal');
% A)
x1 = fft(y,10000);
x2 = ifft(x1,10000);
subplot(4,1,2);
stem(x2);
title('Signal at 10,000');
% B)
x3 = fft(y,16000);
x4 = ifft(x3,16000);
subplot(4,1,3);
stem(x4);
title('Signal at 16,000');
% C)
x5 = fft(y,17901);
x6 = ifft(x5,17901);
subplot(4,1,4);
stem(x6);
title('Signal aat 17,901');
% Experiment Four
Error1 = y ./ x2;
Error2 = y ./ x4;
Error3 = y ./ x6;
fprintf('Errror at 10,000 = %f \n ', Error1);
fprintf('Errror at 16000 = %f \n ', Error2);
fprintf('Errror at 10,000 = %f \n ', Error3);
end
답변 (1개)
Image Analyst
2018년 5월 29일
0 개 추천
y is 73113 elements long while x2 is 10000 elements long. How/why do you expect that to work???
댓글 수: 3
Austin Gaylor
2018년 5월 30일
Image Analyst
2018년 5월 30일
You could use interp1(), but you really need to understand what you want to do, because that's not really the right thing to do. It's just a bandaid patch to the problem that doesn't fix the real problem
Austin Gaylor
2018년 5월 30일
카테고리
도움말 센터 및 File Exchange에서 Transforms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!