user366312
user366312

Reputation: 17026

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

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?

Upvotes: 1

Views: 25269

Answers (1)

user366312
user366312

Reputation: 17026

The commenet from @Benoit_11 solved my issue.

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

Upvotes: 6

Related Questions