How to replace a function by a value

3 Ansichten (letzte 30 Tage)
Albert Garcia
Albert Garcia am 28 Okt. 2019
Kommentiert: Albert Garcia am 28 Okt. 2019
So I have a series of functions that all depend on an initial function. For example, I want to design a helicopter. I have a program that gives an initial weight estimate. This weight estimate is used by other programs to figure out how big my wings, transmission, and rotors are going to be. I, then, have another program that calculates a new weight based on the size of these geometric properties. I would like this value from this new output to be the next input into the geometric sizing programs that originally took in the value of my initial weight estimation program.

Akzeptierte Antwort

the cyclist
the cyclist am 28 Okt. 2019
Bearbeitet: the cyclist am 28 Okt. 2019
Conceptually, something like this?
weightEstimate = initialWeightEstimate
while <some condition>
geometryEstimate = geometricEstimatorFunction(weightEstimate,<other inputs to geometry estimator>)
weightEstimate = weightEstimatorFunction(geometryEstimate,<otherinputs to weight estimator>)
end
  4 Kommentare
the cyclist
the cyclist am 28 Okt. 2019
Yes, this would be a good conceptual solution, if you know the number of iterations you want.
Regarding your "checking to see if a function has been been run" question ... MATLAB will simply run the lines of code in strict order, waiting for the prior one to finish before starting the next one. So, there is no need to check if a prior line has been completed.
Albert Garcia
Albert Garcia am 28 Okt. 2019
Cool. Thank you very much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by