bsxfun: normalizing many vectors

Y(i)=X(i)/||X(i)||2。

e.g.

X =

1     2     3     4

   5     6     7     8

X_norm = sqrt( sum(X.^2,1) );

Y = bsxfun(@rdivide, X, X_norm);

--->

X_norm =

5.0990    6.3246    7.6158    8.9443

Y =

0.1961    0.3162    0.3939    0.4472

0.9806    0.9487    0.9191    0.8944

时间: 2024-08-10 15:09:41

bsxfun: normalizing many vectors的相关文章

Tutorials on training the Skip-thoughts vectors for features extraction of sentence.

Tutorials on training the Skip-thoughts vectors for features extraction of sentence.  1. Send emails and download the training dataset.  the dataset used in skip_thoughts vectors is from [BookCorpus]: http://yknzhu.wixsite.com/mbweb first, you should

matlab函数 bsxfun浅谈(转载)

关于matlab函数 bsxfun本文来源:http://blog.sina.com.cn/s/blog_9e67285801010ttn.html a=[1 2 3];b=[1 2 3]';c=bsxfun(@plus,a,b) c = 2 3 4 3 4 5 4 5 6 相当于:1 2 3 1 1 1 1 2 3 + 2 2 2 1 2 3 3 3 3bsxfun的执行是这样的,如果a和b的大小相同,那么c=a+b. 但如果有某维不同,且a或b必须有一个在这一维的维数为1, 那么bsxfun

TRANSFORMING IMAGES TO FEATURE VECTORS

TRANSFORMING IMAGES TO FEATURE VECTORS I’m keen to explore some challenges in multimodal learning, such as jointly learning visual and textual semantics. However, I would rather not start by attempting to train an image recognition system from scratc

函数bsxfun,两个数组间元素逐个计算的二值操作

转自http://www.cnblogs.com/rong86/p/3559616.html 函数功能:两个数组间元素逐个计算的二值操作 使用方法:C=bsxfun(fun,A,B) 两个数组A合B间元素逐个计算的二值操作,fun是函数句柄或者m文件,也可以为如下内置函数: @plus 加@minus 减@times 数组乘<Simulink与信号处理>@rdivide 左除@ldivide 右除@power 数组幂乘@max 二值最大值@min 二值最小值@rem 余数@mod 求模@ata

Vectors(2): 绘制优美的路径动画

欢迎Follow我的GitHub, 关注我的CSDN. 时代在发展, 技术在进步, Android的Vector图像的时代已经到来. 在Google的最新支持库v23.2中, AppCompat类已经使用Vector图像, 使得AAR包减少9%, 大约70KB, 惠及所有高版本的应用. 当然我们也可以使用Vector, 瘦身应用. Vector图像是SVG格式在Android的表现形式. SVG图像适应屏幕, 图片较小, 还有很多优点, 参考. 关于Vectors的分析, 主要分为两节: (1)

A.Kaw矩阵代数初步学习笔记:2. Vectors

“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔记下载(Academia.edu) 第2章课程讲义下载(PDF) Summary Vector A vector is a collection of numbers in a definite order. If it is a collection of $n$ numbers, it is c

【Matlab开发】函数bsxfun的使用

[Matlab开发]函数bsxfun的使用 版权声明:本文为博主原创文章,转载请注明出处http://blog.csdn.net/lg1259156776/. 说明:当我们想对一个矩阵A的每一列或者每一行与同一个长度相等的向量a进行某些操作(比较大小,乘除等)时,我们只能用循环方法或者利用repmat函数将要操作的向量a复制成和A一样尺寸的矩阵,进而进行操作.从MATLAB R2007a开始,再遇到类似的问题时,我们有了简洁高效的方法,即利用bsxfun函数. bsxfun函数用法 [函数描述]

matlab学习笔记 bsxfun函数

matlab学习笔记 bsxfun函数 最近总是遇到 bsxfun这个函数,前几次因为无关紧要只是大概看了一下函数体去对比结果,今天再一次遇见了这个函数,想想还是有必要掌握的,遂查了些资料总结如下.   函数bsxfun [功能描述]两个数组间元素逐个计算. [应用场合]当我们想对一个矩阵A的每一列或者每一行与同一个长度相等的向量a进行某些操作(比较大小,乘除等)时,我们只能用循环方法或者利用repmat函数将要操作的向量a复制成和A一样尺寸的矩阵,进而进行操作.从MATLAB R2007a开始

Matlab中bsxfun和unique函数解析

一.问题来源 来自于一份LSH代码,记录下来. 二.函数解析 2.1 bsxfun bsxfun是一个matlab自版本R2007a来就提供的一个函数,作用是”applies an element-by-element binary operation to arrays a and b, with singleton expansion enabled. 函数用在两个数组间元素逐个计算.比如当我们想对一个矩阵A的每一列或者每一行与同一个长度相等的向量a进行某些操作(比较大小,乘除等)时,我们只