Got Questions? Get Answers.
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:
without matlab for loop

Subject: without matlab for loop

From: Ben

Date: 5 Dec, 2010 19:55:04

Message: 1 of 1

Hi all,

Could I implement the following code segment without using for loop?

Q = 0;
for n = 1:N
tmp = 0;
parfor m = 1:M
d = [d1(m,n); d2(m,n)];
dm = d' / sigma2(:,:,m) * d; % Mahalanobis distance
Pmn(m,n) = exp(-0.5*dm) / sqrt(det(sigma2(:,:,m)) + eps;
tmp = sum(Pmn(:,n), 'double') + c;
Pmn(:,n) = Pmn(:,n) / tmp;
Q = Q - log(tmp);

Thank you,

Tags for this Thread

What are tags?



Contact us