Matlab - Double 类型输入参数的未定义错误

标签 matlab double undefined runtime-error

<分区>

我正在尝试编写一个函数来完成 conv2(h1,h2,A) & conv2(...'shape') 的功能,而无需使用内置功能。 (速度目前不是问题)。如此处定义:http://www.mathworks.co.uk/help/matlab/ref/conv2.html

这些是我的命令:

    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 );

这是我的错误:

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

如果我运行相同的命令但使用 conv2 函数:

    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 );

它工作正常吗?...我已经四处搜索并盯着这段代码看了好几个小时。我只是看不到它。有人注意到我的功能有什么问题吗?

最佳答案

Undefined function 'xxx' for input arguments of type 'double' 通常表示函数 xxx 不在路径上。

要确认这确实是问题所在,请在命令行键入 which convfft,因为 which 应该指示 Matlab 知道文件所在的位置。

如果找不到该文件,请确保它存在于您的计算机上,并将该文件的父文件夹添加到 Matlab 路径中。

关于Matlab - Double 类型输入参数的未定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14874828/

相关文章:

matlab - Matlab/CUDA : ocean wave simulation

Matlab 从文本文件到稀疏矩阵。

javascript - 添加无冲突js后未定义的jQuery

compiler-errors - java中未定义的错误

c++ - "undefined reference to"共享库中的许多(全部?)函数(新手)

matlab - rm ANOVA(Matlab)期间具有随机因子的误差

arrays - Matlab中对象数组的调用方法

c++ - C++ 中的异常处理 : Throwing a double when using "throw(int)"

c++ - Qt toDouble() 方法转换为 int

c++ - 重载 ‘pow(const double&, double)’的调用不明确