Skip navigation
7038 Views 26 Replies Latest reply: Aug 28, 2012 3:52 PM by ptc-4391462 RSS
ptc-4391462 Bronze 36 posts since
Dec 31, 2011
Currently Being Moderated

Feb 2, 2012 2:44 AM

For loop output to matrix

I am a beginner with programming in Mathcad.  I am having trouble understanding how to use FOR Loops to dump results to a matrix from which I can  extract values to plot in a graph. I wish to solve a non-linear equation and evaluate this function for a range of values and then graph the results in the form of a Bifurcation Diagram. The non-linear equation becomes chaotic at certain input force values.

I have constructed a Runge Kutta 4th order function to integrate the equation and develop the displacement and velocity time waveforms - no problem. As a first step I want to evaluate the equation for a range of forces and store the velocity (Y2) versus time (Y0) waveforms in a matrix. As a second stage I want to sample the velocity waveform after it has stabilised (after say 100 cycles) at periopdic intervals to see if the velocity amplitude remains stable or whether a chaotic behaviour occurs.

The attached Mathcad file has the integration front end and my attempt at a nested FOR loop to index the force amplitude and store the velocity (Y2) values in a matrix. The matrix output only seems to store the last iteration.  I would appreciate if someone could get me over this first hurdle to evaluate all velocity waveforms for the range of forces 'A".

Extracting data to a new matrix after every N1 data points would be the next step and then plotting this data as aBifurcation Diagram.

Any assiatnce would be appreciated.




More Like This

  • Retrieving data ...

Bookmarked By (0)


  • Correct Answers - 3 points
  • Helpful Answers - 1 points