Question on Creating a simple MATLAB Loop

조회 수: 6 (최근 30일)
Ramzan
Ramzan 2012년 7월 19일
Hi All,
Good day!
I'm very-very 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.
Finally, i want it to be plotted, for example in this case the cumulative values of DVTn vs Time.
So, please help me on how to do this in MATLAB.
Any form of helps would be very much appreciated.
Thanks !!!
-----------------------------------------------------------------------------------------------------------
% DVT vs Time ;TRANSIENT CHARACTERISTICS
% Constants and Initial Conditions
VCG = 15; %Applied voltage at control gate, V
TOX = 6*10^(-7); % tunnel oxide thickness in cm
CR=0.65;
AFN = 1.1*10^(-6); % A parameter for FN tunneling, in A/V^2
BFN = 2.8*10^8; % B parameter for FN tunneling, in V/cm
AINJ = (20*10^(-7))^2; % tunneling area (F^2) in cm^2
IPD=9*10^(-7); % IPD EOT in cm
CFG=(3.9*8.85*10^(-14)*AINJ)/IPD;
% Initial condition at t=0, when VCG applied and QFG=0
VFG0 =CR*VCG;
EOX0 = VFG0/TOX;
JFN0 = AFN*EOX0^2*exp(-BFN/EOX0);
DQFG0 = JFN0*AINJ*1*10^(-9);
DVT0 = DQFG0/CFG;
DVT0
'after 1 ns'
VFG1 =CR*(VCG-DVT0);
EOX1 = VFG1/TOX;
JFN1 = AFN*EOX1^2*exp(-BFN/EOX1);
DQFG1 =JFN1*AINJ*1*10^(-9);
DVT1 = DQFG1/CFG;
DVT0+DVT1
'after 2ns'
VFG2 =CR*(VCG-(DVT0+DVT1));
EOX2 = VFG2/TOX;
JFN2 = AFN*EOX2^2*exp(-BFN/EOX2);
DQFG2 = JFN2*AINJ*1*10^(-9);
DVT2 = DQFG2/CFG;
DVT0+DVT1+DVT2
'after 3ns'
Resume calculating DVTn until reacing a certain stop time.
Plot (DVTn, time).

채택된 답변

Miro
Miro 2012년 7월 19일
The simplest form of a loop is
Result = [];
PLACE THE INITIAL AND CONSTANTS PARAMETERS HERE
for i = 1 : x
1.PLACE THE CALCULATION HERE
2.STORE THE RESULTS (like Result(i) = outputofcalculation)
3.CHANGE THE PARAMETERS (like x=x+10)_
end
this runs the calculation x times.

추가 답변 (1개)

Ramzan
Ramzan 2012년 7월 19일
Hi Miro,
Appreciate your input.
Will try it and see how it goes.
Many thanks!!!

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by