Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to add weights to data matrix

Subject: How to add weights to data matrix

From: David

Date: 7 Jul, 2012 16:56:07

Message: 1 of 7

Hi,

I have some data in a matrix with size 50*2. Now i want to add weights to my data so that I can have some good clustering of data.

How can I add weights to data??

Thanks in advance.

Subject: How to add weights to data matrix

From: Matt J

Date: 7 Jul, 2012 17:19:11

Message: 2 of 7

"David " <munnavinnu@gmail.com> wrote in message <jt9pn7$9a$1@newscl01ah.mathworks.com>...
> Hi,
>
> I have some data in a matrix with size 50*2. Now i want to add weights to my data so that I can have some good clustering of data.
>
> How can I add weights to data??

Assuming your weights is 50x1,

weighted_data = bsxfun(@times, weights, data50x2)

Subject: How to add weights to data matrix

From: David

Date: 7 Jul, 2012 17:50:08

Message: 3 of 7

"Matt J" wrote in message <jt9r2f$4jd$1@newscl01ah.mathworks.com>...
> "David " <munnavinnu@gmail.com> wrote in message <jt9pn7$9a$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I have some data in a matrix with size 50*2. Now i want to add weights to my data so that I can have some good clustering of data.
> >
> > How can I add weights to data??
>
> Assuming your weights is 50x1,
>
> weighted_data = bsxfun(@times, weights, data50x2)

Will this function still works if my data increases,.... like 50*4, 50*5, 100*6 etc.


Thanks.

Subject: How to add weights to data matrix

From: David

Date: 7 Jul, 2012 17:55:08

Message: 4 of 7

"Matt J" wrote in message <jt9r2f$4jd$1@newscl01ah.mathworks.com>...
> "David " <munnavinnu@gmail.com> wrote in message <jt9pn7$9a$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I have some data in a matrix with size 50*2. Now i want to add weights to my data so that I can have some good clustering of data.
> >
> > How can I add weights to data??
>
> Assuming your weights is 50x1,
>
> weighted_data = bsxfun(@times, weights, data50x2)


I don't have the weights, I want find them.

Subject: How to add weights to data matrix

From: Matt J

Date: 7 Jul, 2012 17:58:16

Message: 5 of 7

"David " <munnavinnu@gmail.com> wrote in message <jt9ssg$akt$1@newscl01ah.mathworks.com>...
>
> > Assuming your weights is 50x1,
> >
> > weighted_data = bsxfun(@times, weights, data50x2)
>
> Will this function still works if my data increases,.... like 50*4, 50*5, 100*6 etc.
============

If it's not clear to you whether it will work, you should read the documentation on BSXFUN to understand what it is doing.

Subject: How to add weights to data matrix

From: David

Date: 7 Jul, 2012 18:06:08

Message: 6 of 7

"Matt J" wrote in message <jt9tbo$c5m$1@newscl01ah.mathworks.com>...
> "David " <munnavinnu@gmail.com> wrote in message <jt9ssg$akt$1@newscl01ah.mathworks.com>...
> >
> > > Assuming your weights is 50x1,
> > >
> > > weighted_data = bsxfun(@times, weights, data50x2)
> >
> > Will this function still works if my data increases,.... like 50*4, 50*5, 100*6 etc.
> ============
>
> If it's not clear to you whether it will work, you should read the documentation on BSXFUN to understand what it is doing.

I understood that the function will multiply the weights to data, but I want to find the weights from the data.

Thanks.

Subject: How to add weights to data matrix

From: Matt J

Date: 7 Jul, 2012 18:13:10

Message: 7 of 7

"David " <munnavinnu@gmail.com> wrote in message <jt9tqg$dnl$1@newscl01ah.mathworks.com>...
>
>
> I understood that the function will multiply the weights to data, but I want to find the weights from the data.
==============

Then you must tell us what mathemetical relationship is supposed to exist between the weights and the data. Only then can we tell you how to translate that relationship into code.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us