Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Help needed badly for a simple MATLAB looping
Posted:
Jul 19, 2012 9:41 AM


"Ramzan " <ramzansatf@yahoo.com> wrote in message news:ju8bqr$76i$1@newscl01ah.mathworks.com... > Hi All, > > Good day! > > I'm veryvery new to MATLAB, and had a very limited exposure to other > programming languages (learn an introduction course in FORTRAN but then it > was more then 25 years ago). > > I need to calculate a transient characteristic of simple dynamic system. > Its seems like a very simple and straight forward loop coding but i > couldn't figure out from standard MATLAB manual in the time that is > available to me. > The problem as follow; > I have some constants and initial conditions. > > Use the constants in the formulas and then simple calculate the rest. The > output of the previous formula becomes the input of the next. > And i'm going to recalculate those with fixed time increment, and able to > tell the program at what time to stop.
It almost sounds like you're trying to build your own basic ODE solver. If that's the case, and you can express the ODE as y' = f(t, y) where you know the function f(t, y) then you can solve this using the ODE solvers included with MATLAB. Take a look at the help and documentation for the ODE45 function as a first pass:
help ode45
doc ode45
The one concern I have is that your parameters cover widely varying orders of magnitude. CFG turns out to be somewhere around 1e35 while BFN is on the order of 1e8. Using something smaller than centimeters in your expressions (expressing TOX as the thickness in micrometers or nanometers and making similar changes to the other parameters, perhaps?) may allow the parameters to cover fewer orders of magnitude.
 Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com



