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:
vectorizaton reshape repmat

Subject: vectorizaton reshape repmat

From: Jose

Date: 24 Mar, 2009 14:08:01

Message: 1 of 1

Somebody can help me to vectorize this piece of code wit the command
reshape or repmat?

x=rand(3,2) % 2D- dimensional data
a=rand(1,2) % 2D- dimensional parameter

z=repmat(x, [nrp nrv])

inversa=2x2 matrix [ 1 2; 3 4]

 How I can built a matrix z (3x2) vectorizing avoiding loops as:

 (x(1,:)-a(1,:))*inversa*(x(1,:)-a(1,:))' (x(1,:)-a(2,:))*inversa*(x(1,:)-a(2,:))'
 (x(2,:)-a(1,:))*inversa*(x(2,:)-a(1,:))' (x(2,:)-a(2,:))*inversa*(x(2,:)-a(2,:))'

(x(3,:)-a(1,:))*inversa*(x(3,:)-a(1,:))' (x(3,:)-a(2,:))*inversa*(x(3,:)-a(2,:))'
Thanks in advance,


Tags for this Thread

No tags are associated with 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