how can use it for more than two features plot for multiclass svm?

3 次查看(过去 30 天)
pos = find(y == 1); neg = find(y == -1); plot(x(pos,1), x(pos,2), 'ko', 'MarkerFaceColor', 'b'); hold on; plot(x(neg,1), x(neg,2), 'ko', 'MarkerFaceColor', 'g')
% Plot the decision boundary plot_x = linspace(min(x(:,1)), max(x(:,1)), 30); plot_y = (-1/w(2))*(w(1)*plot_x + b); plot(plot_x, plot_y, 'k-', 'LineWidth', 2)
title(sprintf('SVM Linear Classifier with C = %g', C), 'FontSize', 14)
I also get this error Error using + Matrix dimensions must agree. which is for this statement plot_y = (-1/w(2))*(w(1)*plot_x + b);
where w is 2*2 and b is 3*1
kindly help!

回答(1 个)

Salaheddin Hosseinzadeh
Hey shah,
There's no surprise you got error adding plot_x and b, because apparently plot_x is 1x30 and as you said b is 3*1
You can't do it either! I don't really know how can someone help u!

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by