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

Learn moreOpportunities for recent engineering grads.

Apply TodaySearch Solutions

1 – 25 of 25 previous next

59Size

0 Comments

40Size

0 Comments

47Size

0 Comments

38Size

0 Comments

42Size

0 Comments

36Size

0 Comments

22Size

1 Comment

1 Comment

bainhome
on 20 May 2013

This is a shamless answer,I admit...But the explicit recurrence relation is insanely slow,hope to see you guys solve this problem more efficient.

53Size

0 Comments

95Size

0 Comments

39Size

0 Comments

39Size

0 Comments

54Size

0 Comments

28Size

0 Comments

46Size

0 Comments

42Size

0 Comments

45Size

0 Comments

53Size

0 Comments

36Size

0 Comments

54Size

0 Comments

1 player likes this solution

76Size

0 Comments

48Size

0 Comments

37Size

3 Comments

3 Comments

Richard Zapor
on 10 Jan 2013

I prefer g(end+1:end+g(gptr))=gptr; to usage of repmat. My machine to solve 1234567 takes 48msec vs 15.4 sec using repmat. repmat has a performance issue with large column replication. Unfortunately score is code size and not time.

Alfonso Nieto-Castanon
on 10 Jan 2013

totally agree (not to mention the entire 'growing inside a loop' uglyness), cody style is very far from any reasonable coding standard...

James
on 10 Jan 2013

That's very interesting. The time difference on my (presumably much older) version of MATLAB is much less. Your method gives me an average time of about 18.8 sec, while repmat gives me an average time of 19.5 sec.

55Size

0 Comments

43Size

0 Comments

43Size

0 Comments

1 – 25 of 25 previous next