using variables from workspace
显示 更早的评论
I am creating a newton raphson m file which takes in two variables pressure and temperature and converges to give a correct v value using the redlich kwong equation
The inital estimate is set in the code as x=1
After one simulation the value of x converges to be more accurate is it possible to store the new variable to the workspace and use in prior simulations.
to employ a parameter sweep i.e. for value of x use as initial estimate solution just obtained for previous value of P and T.
回答(1 个)
Walter Roberson
2023-3-9
0 个投票
Please see http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F for information on approaches
Yes, it is possible to store state information in the calling routine, but it is not recommended. It would be better to accept a parameter that is the initial location and use that, with it being the responsibility of the calling function to pass back in the previous result (or a different result if they have reason to know that the system has jumped state.)
类别
在 帮助中心 和 File Exchange 中查找有关 Newton-Raphson Method 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!