Matlab - Undefined Error for Input Arguments of Type Double [duplicate]

穿精又带淫゛_ 提交于 2019-12-22 10:27:31

问题


I'm trying to write a function that does what conv2(h1,h2,A) & conv2(...'shape') does without using the built-in function. (speed is currently not an issue). as defined here: http://www.mathworks.co.uk/help/matlab/ref/conv2.html

These are my commands:

    imgC = imread('camerman.tif');
    imgC = double(imgC);

    sigma = 1;
    inp = (-1 .*2.5 .*sigma):1:(2.5 .* sigma);                                  
    gauss1d = (1/(sigma .* sqrt(2*pi))).*exp(-(inp.^2/(2.*sigma.*sigma)));      
    gaussprime = diff(gauss1d);       

    x = conv2fft(gaussprime,1,imgC , 'same');   
    y = conv2fft(1,gaussprime.',imgC , 'same'); 
    blur = conv2fft (gauss1d, gauss1d, imgC );

This is my error:

    Undefined function 'convfft' for input arguments of type 'double'.
    Error in conv2fft (line 81) `if size(convfft(a(1,:),r),1)==1`

If I run the same commands but use the conv2 function:

    imgC = imread('camerman.tif');
    imgC = double(imgC);

    sigma = 1;
    inp = (-1 .*2.5 .*sigma):1:(2.5 .* sigma);                                  
    gauss1d = (1/(sigma .* sqrt(2*pi))).*exp(-(inp.^2/(2.*sigma.*sigma)));      
    gaussprime = diff(gauss1d);       

    x = conv2(gaussprime,1,imgC , 'same');   
    y = conv2(1,gaussprime.',imgC , 'same'); 
    blur = conv2(gauss1d, gauss1d, imgC );

It works fine?... I've been searching around and staring at this code for hours. I just can't see it. Anyone notice what is wrong with my function?


回答1:


Undefined function 'xxx' for input arguments of type 'double' typically indicates that the function xxx is not on the path.

To confirm that this is indeed the issue, type which convfft at the command line, since which should indicate where Matlab knows the file is located.

If the file is not found, make sure that it exists on your computer, and add the file's parent folder to the Matlab path.



来源:https://stackoverflow.com/questions/14874828/matlab-undefined-error-for-input-arguments-of-type-double

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!