<PAGE>   1
                                                                    EXHIBIT 10.4


                              EMPLOYMENT AGREEMENT


         THIS AGREEMENT, made as of the 31st day of October, 1997, by and
between MECHANICAL DYNAMICS, INC., a Michigan corporation (the "Company"),
having offices located at 2301 Commonwealth Blvd., Ann Arbor, Michigan 48105,
and Douglas M. Peterson of Canton, Michigan ("Employee").

WITNESSETH:

         WHEREAS, the Company desires to employ the Employee to devote his full
time and attention to the business of the Company and Employee desires to be so
employed.

         NOW, THEREFORE, in consideration of the foregoing and of the mutual
covenants herein contained, the parties hereto agree as follows:

         1.       EMPLOYMENT. The Company hereby agrees to employ Employee in
                  the capacity of Vice President of Product Development of the
                  Company. Employee hereby accepts this employment and agrees to
                  diligently and conscientiously devote his full and exclusive
                  business time and attention to the affairs of the Company. In
                  his capacity as Vice President of Product Development of the
                  Company, Employee shall perform such duties of an executive
                  nature as shall be assigned to him from time to time by the
                  President or the Board of Directors and Employee shall at all
                  times discharge his duties in consultation with and under the
                  supervision of the President and the Board of Directors.

         2.       TERM. The term of this Agreement shall commence on the date
                  hereof and shall terminate on December 31, 1998. This
                  Agreement may be extended for an additional one (1) year term,
                  upon such terms as may be mutually agreed between Employee and
                  the Company.

         3.       COMPENSATION. Employee's compensation hereunder, including
                  base salary, bonus, vacation and other fringe benefits, for
                  the term of this Agreement are set forth in Attachment I
                  annexed hereto. The Company and Employee agree that during the
                  term of this Agreement the fringe benefits offered to Employee
                  shall be as set forth in Attachment I.

         4.       DISABILITY. In the event that Employee is absent from his
                  employment by reason of illness or other incapacity for a
                  period of six (6) consecutive months, Employee shall
                  nevertheless be entitled to receive his full base salary
                  hereunder as well as his pro-rata bonus, vacation accruals and
                  all fringe benefits during said six (6) month period.
                  Thereafter, during the continued period of his illness or
                  incapacity in excess of six (6) months, Employee shall be
                  entitled to receive such long-term disability benefits as are
                  payable under the Company's then long-term disability
                  insurance program. He shall also receive continued health and
                  life insurance benefits for the remaining term of this
                  Agreement. Except as provided above, all bonus accruals,
                  vacation accruals and other fringe benefits shall cease at the
                  end of said six (6) month period. Notwithstanding the
                  foregoing, Employee's salary, bonus, vacation and other fringe
                  benefits shall be fully reinstated upon his complete return to
                  employment and the full discharge of his duties hereunder.

         5.       DEATH. In the event that Employee dies during the term of this
                  Agreement while still employed hereunder and drawing his full
                  base salary, then the Company shall continue to pay an amount
                  equal to one hundred percent (100%) of Employee's monthly base
                  salary (as of the date of his


<PAGE>   2

                  death) to his designated beneficiary for a period of two (2)
                  months subsequent to the date of his death. Such payments
                  shall be in addition to any other death benefits payable to
                  Employee's designated beneficiary from life insurance or
                  otherwise.

         6.       CHANGE OF DUTIES; RELOCATION. In the event that during the
                  term of this Agreement the President or the Board of Directors
                  chooses to change the Employee's title and/or his duties
                  hereunder, this Agreement shall nevertheless remain in full
                  force and effect in accordance with its terms and no such
                  change shall constitute grounds upon which Employee may
                  terminate this Agreement. In the event that the Board of
                  Directors directs Employee to relocate away from Ann Arbor,
                  Michigan, then Employee shall be entitled to resign and to
                  receive as severance compensation, the base salary and fringe
                  benefits provided in Section 7.2 hereof.

         7.       TERMINATION.

                  7.1 For Cause; Resignation; Retirement. In the event that
                      Employee is discharged from his employment during the term
                      of this Agreement for "Cause" (as hereinafter defined), or
                      Employee voluntarily resigns or retires, then Employee
                      shall be entitled to receive only such payments and/or
                      benefits as would be provided to other employees of the
                      Company under similar circumstances in accordance with the
                      Company's employee policies and procedures then in effect.

                  7.2 Without Cause. In the event Employee is discharged from
                      his employment during the term of this Agreement without
                      "Cause", then the Company shall continue to pay Employee's
                      base salary and provide all fringe benefits and pro rata
                      bonus, if applicable, in each case as in effect at the
                      date of Employee's termination, for a period equal to the
                      greater of twelve (12) months from the date of termination
                      or the remaining term of this Agreement (including any
                      renewals or extension hereof). Such payment and benefits
                      shall be in lieu of all other payments and benefits to
                      which Employee might otherwise be entitled under the
                      Company's employee policies and procedures and/or under
                      this Agreement.

                  7.3 Definition. For purposes of this Agreement, the term
                      "Cause" shall mean:
                      (i) Failure or refusal of Employee to work; or
                      (ii) Violation of written directives of the Board of
                      Directors or the President by Employee following
                      Employee's receipt thereof; or
                      (iii) Intentional misrepresentation to, or concealment of
                      a material fact regarding the operations of the Company
                      from, the Board of Directors or the President by Employee;
                      or
                      (iv) A material breach of this Agreement by Employee; or
                      (v) Conviction of a crime involving moral turpitude.
                      Except in the case of (v) above, termination of this
                      Agreement for "Cause" shall only become effective thirty
                      (30) days after Employee has received written notice of
                      such termination from the Company specifying the details
                      of such "Cause". During such thirty (30) day period,
                      Employee shall be entitled to a formal meeting with the
                      Board of Directors for the purpose of presenting reasons
                      why the Agreement should not be terminated.

                  7.4 Change of Control. In the event that more than fifty
                      percent (50%) of the issued and outstanding capital stock
                      of the Company or more than fifty percent (50%) of the
                      assets of the Company is purchased by any entity, person
                      or group of persons acting in concert, and if the
                      remaining term of this Agreement is less than one (1) year
                      from the effective date of such change of control, then
                      the term of this Agreement shall be automatically extended
                      through a date one (1) year from such effective date.


<PAGE>   3

                  7.5 Release. Anything contained in this Section 7 to the
                      contrary notwithstanding, the payment of any sums to
                      Employee under subsections 7.1, 7.2 or 7.4 hereof, shall
                      be conditioned upon (i) Employee executing and delivering
                      to the Company the Full And Final Release attached hereto
                      as Attachment II (the "Release") and (ii) in the event
                      Employee is over forty (40) years of age on the date of
                      execution of the Release, upon Employee not exercising his
                      right to revoke said Release after having executed it.

         8.       RESTRICTIVE COVENANT. Employee agrees that during the term of
                  this Agreement and for a period of two (2) years after the
                  termination or expiration of this Agreement, he will not
                  directly or indirectly, for his own benefit, or for or with
                  any other person, firm, or corporation (a) own, manage, engage
                  in, be employed by or consult for any business in the United
                  States (other than ass a holder of less than 5% of the
                  outstanding capital stock of a publicly traded corporation)
                  which competes directly with the business presently conducted
                  by the Company, or (b) encourage, solicit, attempt to hire as
                  an employee or consultant or otherwise attempt to persuade any
                  other employee of the Company to leave the employ of the
                  Company. For purposes of this Agreement, the "business
                  presently conducted by the Company" shall mean the
                  development, manufacture, marketing or licensing of computer
                  programs or software for mechanical systems simulation (often
                  referred to as "multi-body system analysis"). Employee further
                  agrees that the Company's remedy at law for any breach of this
                  restrictive covenant is inadequate and that the Company shall
                  be entitled to injunctive relief with respect to any breach of
                  this covenant.

         9.       NOTICE. Any notice to be delivered under this Agreement shall
                  be given in writing and delivered, personally or by certified
                  mail, postage prepaid, addressed to the Company or Employee at
                  their last known addresses.

         10.      ENTIRE AGREEMENT. This Agreement constitutes the entire
                  understanding of the parties hereto regarding the subject
                  matter hereof, and there are no other agreements, conditions
                  or representations, oral or written, express or implied, with
                  regard thereto. This Agreement may be amended only in writing,
                  signed by both parties. Notwithstanding anything in this
                  Agreement to the contrary, nothing in this Agreement is
                  intended to or shall in anyway affect the rights and
                  obligations of the parties set forth in that certain
                  Noncompetition Agreement dated October 31, 1997, between the
                  Company and Employee.

         11.      BINDING EFFECT. The provisions of this Agreement shall be
                  binding upon and shall inure to the benefit of both of the
                  parties hereto and their respective successors and assigns.


         12.      GOVERNING LAW. This Agreement shall be governed by and
                  construed under in accordance with the laws of the State of
                  Michigan.

         IN WITNESS WHEREOF, the parties hereto have duly executed this
Agreement as of the day and date first above written.
                                  "COMPANY"
                                  MECHANICAL DYNAMICS, INC.
                                  By:  /s/ Robert R. Ryan
                                      ---------------------------------------
                                           Robert R. Ryan, President

                                  "EMPLOYEE"

                                  /s/ Douglas M. Peterson
                                  ------------------------------------------
                                  Douglas M. Peterson

<PAGE>   4



                                  Attachment I
                                Compensation Plan
                               Douglas M. Peterson
                      Vice President of Product Development


Base Salary:                        $100,000/year.*
Car Allowance:                      $300/month.
Vacation/Sick Days:                 15 days/year (vacation); 10 days/year
                                    (sick days).
Fringe Benefits:                    As provided for all employees in accordance
                                    with Company policy (but without any waiting
                                    or eligibility periods) plus additional life
                                    insurance to bring total life insurance to
                                    two times Employee base salary; provided,
                                    that Employee will continue to receive
                                    medical benefits under the current medical
                                    plan at StatDesign, Inc. ("SDI"), at
                                    Company's expense, until December 31, 197
                                    and thereafter he will receive medical
                                    benefits under the Company's medical plan.
Bonus/Commission:                   Per following bonus/commission matrix.
Other:                              15,000 stock options/4-year vesting period.
                                    Employee will receive credit for his years
                                    of service with SDI, but Employee will not
be entitle to or otherwise receive from the Company any 401(k) employee match
related to such years of service.

The bonus/commission matrix is as follows:

<TABLE>
<S>                                                                           <C>
Commission+
     StatDesign Consulting Service Gross Revenue
           Up to $2 million                                                       1%
           Incremental Amount Beyond $2 million                                   3%
     StatDesign Software Gross Revenue
           ADAMS/Pre                                                              2%
           AutoDOE                                                                2%
           Smart Chassis                                                          2%
Bonuses
     Completion of AutoDOE Toolkit                                                $20,000
     Bonus for Smart Chassis (over and above any other bonuses/commissions)       3%
</TABLE>

----------------------------

         *   Minimum total compensation(consisting of base salary, commissions
             and bonuses) first twelve months -- $125,000

         +   The Company will keep records of information relating to the
commissions payable to Employee and, upon request of Employee, will make such
records available to Employee.




<PAGE>   5


                                  ATTACHMENT II

                            MECHANICAL DYNAMICS, INC.
                             FULL AND FINAL RELEASE


Employee    ______________________________________________________

Title       ______________________________________________________

Forwarding
Address     ______________________________________________________

For good and valuable consideration, the receipt and adequacy of which are
hereby acknowledged, the undersigned hereby agrees as follows:

1. I affirm all of my obligations under the Confidentiality and Noncompetition
Agreement dated October 31, 1997 (the "Confidentiality/Noncompetition
Agreement"), between MDI and me to the extent such obligations otherwise remain
in effect in accordance with the terms thereof.

2. I hereby release, acquit and forever discharge MDI, each of its subsidiaries
and all of their respective past and present agents, representatives, employees,
heirs, executors, administrators, officers, directors, shareholders, attorneys,
successors and assigns (collectively "Releasees") from any and all manner of
action and causes of action, suits, choses in action, contracts, covenants,
claims, damages, costs, expenses, liabilities, debts, sums of money,
commissions, compensation, judgments, executions, demands and rights whatsoever,
at law or in equity, of any nature whatsoever, which I may not have, or which
may hereafter accrue to me against Releasees, by reason of events occurring
prior to, or facts or circumstances existing on the date hereof, subject,
however to payment in full for all amounts owed to me under Section 7 of my
employment agreement with MDI dated October 31, 1997 and to the rights (if any)
I have to purchase common stock of MDI pursuant to that certain Stock Option
Agreement between me and MDI dated October 31, 1997.

3. I hereby covenant that I will refrain from commencing any action or suit, or
prosecuting any pending action or suit, at law or in equity, against Releasees
on account of any action or cause of action which not exists or which may
hereafter accrue in my favor upon the basis of facts existing at the date
hereof. In addition to any other liability which shall accrue upon the breach of
this covenant, I shall be liable to pay all attorneys' fees and costs incurred
by Releasees in the defense of such action or suit.

4. I have returned all MDI property to the President or CEO of MDI or their
respective designees. This return of property includes all materials that
contain any Proprietary Information (as defined in the
Confidentiality/Noncompetition Agreement), including but not limited to, sales
and marketing materials, pricing information and computer software-related
materials, including demonstration materials, user manuals, etc.


<PAGE>   6


5. I have been apprised of my rights to continue medical and/or dental coverage
for myself and/or my dependent(s).

6. THIS FULL AND FINAL RELEASE IS FREELY AND VOLUNTARILY GIVEN BY ME WITHOUT
DURESS OR COERCION AND AFTER CONSULTATION WITH COUNSEL AND I HAVE CAREFULLY AND
COMPLETELY READ ALL OF THE TERMS AND PROVISIONS OF THIS FULL AND FINAL RELEASE.


                                         --------------------------------
                                               Signature of Employee

                                         --------------------------------
                                                        Name

                                         Date:
                                              ---------------------------








<PAGE>   7





                     FIRST AMENDMENT TO EMPLOYMENT AGREEMENT


         THIS FIRST AMENDMENT, made as of the 31st day of December, 1998, by and
between MECHANICAL DYNAMICS, INC., a Michigan corporation (the "Company"),
having offices located at 2301 Commonwealth Blvd., Ann Arbor, Michigan 48105,
and DOUGLAS M. PETERSON, of Canton, Michigan ("Employee"), for the purpose of
amending that certain Employment Agreement between the Company and Employee
dated as of October 31, 1997 ( the "Employment Agreement").


         WITNESSETH:

         WHEREAS, the Company and Employee desire to extend the Employment
Agreement and to confirm such extension herein.

         NOW, THEREFORE, in consideration of the foregoing and of the mutual
covenants contained herein and in the Employment Agreement, the parties hereto
agree as follows:


         A. Section 2 of the Employment Agreement is hereby amended to extend
the term of said Agreement through March 31, 2000.

         B. Except as expressly modified herein, the Employment Agreement shall
remain in full force and effect in accordance with its original terms.

         IN WITNESS WHEREOF, the parties hereto have duly executed this First
Amendment as of the day and year first above written.

WITNESS:                                  COMPANY

                                  MECHANICAL DYNAMICS, INC.


/s/ Linda K. Moore                By:  /s/ Robert R. Ryan
------------------------------         --------------------------------
                                       Robert R. Ryan, President

                                         EMPLOYEE


/s/ Linda K. Moore                     /s/ Douglas M. Peterson
------------------------------         --------------------------------
                                       Douglas M. Peterson






<PAGE>   8



                    SECOND AMENDMENT TO EMPLOYMENT AGREEMENT


         THIS SECOND AMENDMENT, made as of the 1st day of March, 2000, by and
between MECHANICAL DYNAMICS, INC., a Michigan corporation (the "Company"),
having offices located at 2301 Commonwealth Blvd., Ann Arbor, Michigan 48105,
and DOUGLAS M. PETERSON, of Canton, Michigan ("Employee"), for the purpose of
amending that certain Employment Agreement between the Company and Employee
dated as of October 31, 1997, and amended by agreement dated as of December 31,
1998 ( collectively, the "Employment Agreement").


         WITNESSETH:

         WHEREAS, the Company and Employee desire to extend the Employment
Agreement and to confirm such extension herein.

         NOW, THEREFORE, in consideration of the foregoing and of the mutual
covenants contained herein and in the Employment Agreement, the parties hereto
agree as follows:

         A. Section 2 of the Employment Agreement is hereby amended to extend
the term of said Agreement through March 31, 2001.

         B. Except as expressly modified herein, the Employment Agreement shall
remain in full force and effect in accordance with its original terms.

         IN WITNESS WHEREOF, the parties hereto have duly executed this Second
Amendment as of the day and year first above written.

WITNESS:                                       COMPANY

                                        MECHANICAL DYNAMICS, INC.


/s/ Linda K. Moore                      By:  /s/ Robert R. Ryan
-----------------------------                ----------------------------------
                                             Robert R. Ryan, President


                                              EMPLOYEE


/s/ Linda K. Moore                           /s/ Douglas M. Peterson
-----------------------------                ----------------------------------
                                             Douglas M. Peterson







<PAGE>   9

                     THIRD AMENDMENT TO EMPLOYMENT AGREEMENT


         THIS THIRD AMENDMENT, made as of the 1st day of March, 2001, by and
between MECHANICAL DYNAMICS, INC., a Michigan corporation (the "Company"),
having offices located at 2300 Traverwood Drive, Ann Arbor, Michigan 48105, and
DOUGLAS M. PETERSON, of Canton, Michigan ("Employee"), for the purpose of
amending that certain Employment Agreement between the Company and Employee
dated as of October 31, 1997, and amended by agreements dated as of December 31,
1998, and as of March 1, 2000 (collectively, the "Employment Agreement").

         WITNESSETH:

         WHEREAS, the Company and Employee desire to amend the Employment
Agreement to reflect a change in Employee's title and to extend the Employment
Agreement for an additional one-year period.

         NOW, THEREFORE, in consideration of the foregoing and of the mutual
covenants contained herein and in the Employment Agreement, the parties hereto
agree as follows:

         A. Section 1 of the Employment Agreement is amended to change
Employee's title to "Vice President - Product Development" and "Chief Technical
Officer."

         B. Section 2 of the Employment Agreement is hereby amended to extend
the term of said Agreement through March 31, 2002.

         C. Except as expressly modified herein, the Employment Agreement shall
remain in full force and effect in accordance with its original terms.

         IN WITNESS WHEREOF, the parties hereto have duly executed this Third
Amendment as of the day and year first above written.

WITNESS:                                            COMPANY

                                           MECHANICAL DYNAMICS, INC.

/s/ Linda K. Moore                         By: /s/ Robert R. Ryan
-----------------------------                 -------------------------------
                                               Robert R. Ryan, President


                                                    EMPLOYEE

/s/ Linda K. Moore                            /s/ Douglas M. Peterson
-----------------------------                 -------------------------------
                                              Douglas M. Peterson