Error: operator *: nonconformant arguments (op1 is rxc, op2 is rxc )

核能气质少年 提交于 2020-02-16 05:29:23

问题


I have implemented the following function to estimate Parzen Density of a matrix,

parzen.m

function [retval] = parzen (matrix, dataPoint, variance)
    [r c] = size(matrix);
    A = ones(r, c)*dataPoint;
    sub = matrix - A;
    up = sub.^2;
    dw = 2 * variance;
    firstPart = 1/(sqrt(2*pi*variance));
    retval = firstPart * exp((-1)*(up/dw));

Error

>> parzen(train, test, 0.25)
error: parzen: operator *: nonconformant arguments (op1 is 1824x8, op2 is 1824x8
)
error: called from
    parzen at line 3 column 4
>>

How can I get rid of this error?


回答1:


The commenet from @Benoit_11 solved my issue.

A = ones(r,c) .* dataPoint.


来源:https://stackoverflow.com/questions/40444776/error-operator-nonconformant-arguments-op1-is-rxc-op2-is-rxc

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