作业帮 > 综合 > 作业

matlab程序Error using ==> times Matrix dimensions must agree.

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/09/30 16:23:44
matlab程序Error using ==> times Matrix dimensions must agree.
clear all; close all;
I=imread('yls.bmp');
I=im2double(I);
M=2*size(I,1);
N=2*size(I,2);
u=-M/2:(M/2-1);
v=-N/2:(N/2-1);
[U,V]=meshgrid(u, v);
D=sqrt(U.^2+V.^2);
D0=50;
n=6;
H=1./(1+(D./D0).^(2*n));
J=fftshift(fft2(I, size(H, 1), size(H, 2)));
K=J.*H;
L=ifft2(ifftshift(K));
L=L(1:size(I,1), 1:size(I, 2));
figure;
subplot(121);
imshow(I);
subplot(122);
imshow(L);
-----------------------------------
报错
? Error using ==> times
Matrix dimensions must agree.
Error in ==> chap5_26 at 16
K=J.*H;
matlab程序Error using ==> times Matrix dimensions must agree.
请检查J和H两个矩阵的行数列数,看是否一致.