Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 519517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:02:57+00:00 2026-05-13T08:02:57+00:00

I have two clusters of data each cluster has x,y (coordinates) and a value

  • 0

I have two clusters of data each cluster has x,y (coordinates) and a value to know it’s type(1 class1,2 class 2).I have plotted these data but i would like to split these classes with boundary(visually). what is the function to do such thing. i tried contour but it did not help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:02:58+00:00Added an answer on May 13, 2026 at 8:02 am

    Consider this classification problem (using the Iris dataset):

    points scatter plot

    As you can see, except for easily separable clusters for which you know the equation of the boundary beforehand, finding the boundary is not a trivial task…

    One idea is to use the discriminant analysis function classify to find the boundary (you have a choice between linear and quadratic boundary).

    The following is a complete example to illustrate the procedure. The code requires the Statistics Toolbox:

    %# load Iris dataset (make it binary-class with 2 features)
    load fisheriris
    data = meas(:,1:2);
    labels = species;
    labels(~strcmp(labels,'versicolor')) = {'non-versicolor'};
    
    NUM_K = numel(unique(labels));      %# number of classes
    numInst = size(data,1);             %# number of instances
    
    %# visualize data
    figure(1)
    gscatter(data(:,1), data(:,2), labels, 'rb', '*o', ...
        10, 'on', 'sepal length', 'sepal width')
    title('Iris dataset'), box on, axis tight
    
    %# params
    classifierType = 'quadratic';       %# 'quadratic', 'linear'
    npoints = 100;
    clrLite = [1 0.6 0.6 ; 0.6 1 0.6 ; 0.6 0.6 1];
    clrDark = [0.7 0 0 ; 0 0.7 0 ; 0 0 0.7];
    
    %# discriminant analysis
    %# classify the grid space of these two dimensions
    mn = min(data); mx = max(data);
    [X,Y] = meshgrid( linspace(mn(1),mx(1),npoints) , linspace(mn(2),mx(2),npoints) );
    X = X(:); Y = Y(:);
    [C,err,P,logp,coeff] = classify([X Y], data, labels, classifierType);
    
    %# find incorrectly classified training data
    [CPred,err] = classify(data, data, labels, classifierType);
    bad = ~strcmp(CPred,labels);
    
    %# plot grid classification color-coded
    figure(2), hold on
    image(X, Y, reshape(grp2idx(C),npoints,npoints))
    axis xy, colormap(clrLite)
    
    %# plot data points (correctly and incorrectly classified)
    gscatter(data(:,1), data(:,2), labels, clrDark, '.', 20, 'on');
    
    %# mark incorrectly classified data
    plot(data(bad,1), data(bad,2), 'kx', 'MarkerSize',10)
    axis([mn(1) mx(1) mn(2) mx(2)])
    
    %# draw decision boundaries between pairs of clusters
    for i=1:NUM_K
        for j=i+1:NUM_K
            if strcmp(coeff(i,j).type, 'quadratic')
                K = coeff(i,j).const;
                L = coeff(i,j).linear;
                Q = coeff(i,j).quadratic;
                f = sprintf('0 = %g + %g*x + %g*y + %g*x^2 + %g*x.*y + %g*y.^2',...
                    K,L,Q(1,1),Q(1,2)+Q(2,1),Q(2,2));
            else
                K = coeff(i,j).const;
                L = coeff(i,j).linear;
                f = sprintf('0 = %g + %g*x + %g*y', K,L(1),L(2));
            end
            h2 = ezplot(f, [mn(1) mx(1) mn(2) mx(2)]);
            set(h2, 'Color','k', 'LineWidth',2)
        end
    end
    
    xlabel('sepal length'), ylabel('sepal width')
    title( sprintf('accuracy = %.2f%%', 100*(1-sum(bad)/numInst)) )
    
    hold off
    

    classification boundaries with quadratic discriminant function

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have two columns in my sharepoint list [Cluster Name] and [Host Name] I
I have two applications written in Java that communicate with each other using XML
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two classes, and want to include a static instance of one class
I'm trying to configure glassfish to use clusters. I have created node agent, two
I have a system that tracks what documents users view. Each document has its
We currently have a failover sql cluster with two nodes. For a new large
I am playing around with Hadoop and have set up a two node cluster
We have a two node cluster running on Windows 2008 R2. I've installed MSMQ
I have a 22 machine cluster with a common NFS mount. On each machine,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.