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 6857703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:03:38+00:00 2026-05-27T02:03:38+00:00

I understood the first example that they have provided because they have clearly explained

  • 0

I understood the first example that they have provided because they have clearly explained what happens in each line. But for the second example which is usually the one that would be used in practice the most is not explained and iam having a hard time trying to understand it :(. The following are the code lines that iam having trouble with

training = [mvnrnd([ 1  1],   eye(2), 100); ...
            mvnrnd([-1 -1], 2*eye(2), 100)];
group = [repmat(1,100,1); repmat(2,100,1)];

and

sample = unifrnd(-5, 5, 100, 2);

and this is the link -> http://www.mathworks.in/help/toolbox/bioinfo/ref/knnclassify.html

Could someone please explain this as this will not only be beneficial to me, but for all others as well.

  • 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-27T02:03:39+00:00Added an answer on May 27, 2026 at 2:03 am

    The first line of the code you site constructs a training set of vectors, drawn from a multivariate normal distribution, centered around [ 1 1] and [-1 -1] respectively, with standard deviations of 1 and 1 for the sigma x and sigma y for the first class, and 2 and 2 for sigma x and sigma y for the second class. Take 100 of those vectors for each group ( or class).

    Then you construct the group vector, which contains group labels: the first 100 are from class 1 (repmat(1,100,1) is actually the same as ones(100,1)) and the second 100 are from class 2 (repmat(2,100,1) == ones(100,1)*2).

    The second chunk of code you cite actually just generates a matrix containing 100 random data rows, all in the range [-5 , 5] having 2 dimensions (so 2 columns). This matrix gets used to test the classification on.

    You might also take the habit of using the matlab help or doc function on functions you don’t know/understand.

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

Sidebar

Related Questions

I don't understand why the first program in JSP is working, but the second
I have noticed this in a couple of scripting languages, but in this example,
I understand that the first bit is the sign and that the next 8
I don't understand why atoi() is working for every entry but the first one.
From what I understand, in TDD you have to write a failing test first,
I know how to use properties and I understand that they implicitly call underlying
I have this problem to solve that I have no idea how to do
To describe my dilemma, let me first start with an example problem (stolen from
I understand that the proper structure for separation-of-concerns in MVC is to have view-models
First of all, just grant that I do in fact want the functionality of

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.