File Exchange Pick of the Week

January 29th, 2010

Patching together a BMW Z4

Contents

One From the Gallery

This week's Pick is of the Week is Car, by Ronald Biro.

Ronald's file creates a graphical reconstruction of a BMW Roadster, and gets me as close to this sweet ride as I am likely to get in the near future.

Ronald created his version of the Z4, shown here

using nearly 200 calls to his own version of "patches". Actually, Ronald's mypatch calls to and creates low-level surface objects. I'd be interested to hear the author's rationale for using surface objects instead of true patches. (For a brief discussion of the differences, read this.)

Just for comparison, here's the real deal:

Some Notes

When I first ran the Z4.m file, it executed perfectly on my computer. On the other hand, Bob quickly got an error running the same file on his computer. Why the difference? I like to disable warnings in my startup file, so the offending issue was ignored when I ran the code. In this case, had I enabled my warnings (their default state), MATLAB would have warned me me that "the variable "Z4" is also the name of this script." That can be problematic because MATLAB won't be able to differentiate the script from the variable in any context from which the script is called. (So, readers, be aware that you may need to suppress your warnings to run the file.)

One more thing: the integration of the M-Lint Code Analyzer into the MATLAB Editor is really helpful for identifying code issues. There are several places in which (more size-appropriate) preallocations might improve the performance of the code (admittedly, less of an issue in a just-for-fun gallery submission), and other places where command window output could be suppressed with a simple semicolon. Still, I like the file; a lot of work clearly went into it, and it is of limited practical use. My wife might say the same of me. :)

"Virtual Career Fair"

Also, before I sign off, one bit of promotion: The MathWorks will be holding a "Virtual Career Fair" from 11 a.m. to 7 p.m. on February 4, 2010. This Fair is designed to give graduate students and recent grads an opportunity to learn more about careers at The MathWorks, and to chat live with engineers and managers about the company. Interested? Register here.

Comments?


Get the MATLAB code

Published with MATLAB® 7.9

5 Responses to “Patching together a BMW Z4”

  1. berk replied on :

    hi, it looks like the created z4 is a 2008 or older. the z4 in the comparison picture is 2009+ model. I think to be more accurate the comparison picture should be corrected. thanks.

  2. Brett replied on :

    Hi Berk,
    You’re pickier than I; I’ll leave that call to Ronaldo.
    Cheers,
    Brett

  3. bmw z4 extended warranties replied on :

    to be z4 looks like a brand new convertible demon. it is way too costly and offers performance that cheaper ones can also do.

  4. BMV Fire replied on :

    Wow, mahn! I hope these patches work :) BMW Z4 was a beast in its time. Very informative post, Loved it !

  5. Ronald replied on :

    Thanks for the pick!

    As for the mypatch, I had previously worked with patches in various 3D softwares and now that I took a course in numerical analysis I realised how to create them on a more fundamental level. Then I just started building and the rest is just digit crunching.

    regards,
    Ronald

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


MathWorks

Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

These postings are the author's and don't necessarily represent the opinions of The MathWorks.