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!