Output argument "K" (and maybe others) not assigned during call to "linear_kernel".

5 ビュー (過去 30 日間)
federico nutarelli
federico nutarelli 2021 年 5 月 5 日
コメント済み: Star Strider 2021 年 5 月 5 日
Hi all,
the above error apears when I call
K = linear_kernel(tX, tX);
It does not appear if I do not assign linear_kernel(tX,tX).
The function I am referring is:
function K = linear_kernel(x1,x2)
%LINEAR_KERNEL Build a linear kernel.
% Ensure that x1 and x2 are column vectors
x1 = x1(:);
x2 = x2(:);
% Compute the kernel
K = x1' * x2; % dot product
why does this happen?


Star Strider
Star Strider 2021 年 5 月 5 日
Why not just —
K = dot(x1,x2)
See the documentation on the dot function for details.
  2 件のコメント
Star Strider
Star Strider 2021 年 5 月 5 日
Thank you!


その他の回答 (0 件)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by