hello, I would like generate one class of points inside the unit disk in two dimensions, and another class of points in the annulus from radius 1 to radius 2. then, Train SVM Classifiers on this data. this line have error :ezpolar(@(x)1); I run this code in R2014a but it gives the error:
"Error using text Too many input arguments.
Error in ezpolar (line 74) text(0,-1.35*max(abs(RHO)),['r = ', texlabel(rho0)], ...
Error in svmme (line 16) ezpolar(@(x)1)"
this code is:
rng(1); % For reproducibility
r = sqrt(rand(100,1)); % Radius
t = 2*pi*rand(100,1); % Angle
data1 = [r.*cos(t), r.*sin(t)]; % Points
r2 = sqrt(3*rand(100,1)+1); % Radius
t2 = 2*pi*rand(100,1); % Angle
data2 = [r2.*cos(t2), r2.*sin(t2)]; % points
figure;
plot(data1(:,1),data1(:,2),'r.','MarkerSize',15)
hold on
plot(data2(:,1),data2(:,2),'b.','MarkerSize',15)
ezpolar(@(x)1);
ezpolar(@(x)2);
axis equal
hold off
data3 = [data1;data2];
theclass = ones(200,1);
theclass(1:100) = -1;
%Train the SVM Classifier
cl = fitcsvm(data3,theclass,'KernelFunction','rbf',...
'BoxConstraint',Inf,'ClassNames',[-1,1]);

1 个评论

Don't double space your code. Simply read this link to learn how to format it as code instead of ordinary text. Basically highlight and click {}Code.

请先登录,再进行评论。

 采纳的回答

Image Analyst
Image Analyst 2018-7-5

0 个投票

The code runs just fine for me with no errors whatsoever.
By the way, you should read the link I gave you -- you basically took Stephen's fix of your formatting and ruined it again when you edited it. Again, don't double space code, just highlight and click {}Code.

3 个评论

Is it possible that the error is due to the version of MATLAB? My version is MATLAB2014a. I will read the link
Maybe. All I did was copy and paste and run, and it ran fine.
I'll add the release number for you to the right hand side of the page.
fixed. Thank you very much

请先登录,再进行评论。

更多回答(0 个)

类别

Community Treasure Hunt

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

Start Hunting!

Translated by