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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solution will be tested for accuracy AND speed. Any for loops will make the solution too slow to pass the speed test.

Example:

a = [ 1 2 ; 3 5 ]; b = remove_average_vectorized(a); % b is [ -0.5 0.5 ; -1 1 ];

67 correct solutions
107 incorrect solutions

Last solution submitted on Sep 24, 2015

1 player likes this solution

2 Comments

Aurelien Queffurust
on 4 Oct 2012

Fuzzy Logic Toolbox is required for this functioon?

Khaled Hamed
on 5 Oct 2012

I have it on my System Identification toolbox. There is no clear rule what toolbox functions are admissible. If it works, I guess it is allowed.

1 player likes this solution

1 Comment

William Smith
on 2 Oct 2012

Thanks, I was unaware of 'detrend'.

1 Comment

William Smith
on 2 Oct 2012

How come this fails the first time? Are you just on the limits of the time threshold?

1 Comment

William Smith
on 2 Oct 2012

This is almost exactly the same as my 'reference' solution. But later some other people came up with cleaner solutions...

4 Comments