问题
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