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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Jon Agustsson submitted Solution 103505 to Problem 10. Determine whether a vector is monotonically increasing

on 15 Jan 2013

Jon Agustsson submitted Solution 136735 to Problem 39. Which values occur exactly three times?

on 7 Sep 2012

Jon Agustsson submitted Solution 136717 to Problem 39. Which values occur exactly three times?

on 7 Sep 2012

Jon Agustsson submitted a Comment to Solution 133859

It is funny that this
feval(@eval, '[~, ans] = max(x==y);')
has smaller size than this
[~, ans] = max(x==y);

on 6 Sep 2012

Jon Agustsson submitted Solution 135924 to Problem 189. Sum all integers from 1 to 2^n

on 6 Sep 2012

Jon Agustsson submitted Solution 107908 to Problem 16. Return the largest number that is adjacent to a zero

on 8 Jul 2012

Jon Agustsson submitted Solution 107907 to Problem 157. The Hitchhiker's Guide to MATLAB

on 8 Jul 2012

Jon Agustsson submitted a Comment to Solution 4286

Strange I can not delete my first comment. I wanted to format it a bit nicer :)

on 6 Jul 2012

Jon Agustsson submitted a Comment to Solution 4286

Nice indeed.
I am surprised that it is more efficient to solve this with a recursive function than a while loop.
This solution has size 43:
while n(end) > 1
n = [n mod(n(end),2)*(n(end)*2.5+1) + n(end)/2];
end
Is the loop overhead greater than the recursion overhead? Or is the weak point having to go to n(end) at each iteration?

on 6 Jul 2012

Jon Agustsson submitted Solution 103780 to Problem 86. Renaming a field in a structure array

on 27 Jun 2012

Jon Agustsson submitted Solution 103761 to Problem 64. The Goldbach Conjecture, Part 2

on 27 Jun 2012

Jon Agustsson submitted Solution 103513 to Problem 14. Find the numeric mean of the prime numbers in a matrix.

on 27 Jun 2012

Jon Agustsson submitted Solution 103510 to Problem 584. middleAsColumn: Return all but first and last element as a column vector

on 27 Jun 2012

Jon Agustsson submitted Solution 103505 to Problem 10. Determine whether a vector is monotonically increasing

on 27 Jun 2012

Jon Agustsson submitted Solution 103501 to Problem 10. Determine whether a vector is monotonically increasing

on 27 Jun 2012

Jon Agustsson submitted Solution 103487 to Problem 19. Swap the first and last columns

on 27 Jun 2012

Jon Agustsson submitted Solution 103486 to Problem 19. Swap the first and last columns

on 27 Jun 2012

Jon Agustsson submitted Solution 103479 to Problem 17. Find all elements less than 0 or greater than 10 and replace them with NaN

on 27 Jun 2012