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:
Built a matrix z(3x2) avoiding loops

Subject: Built a matrix z(3x2) avoiding loops

From: Jose

Date: 24 Mar, 2009 01:42:01

Message: 1 of 1

Hi everyone, please I need help:

I have the next code:


x=rand(nrp,:) % 2D- dimensional data
a=rand(nrv,:) % 2D- dimensional parameter

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

How I can built a matrix z (3x2) 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

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