Using symbolic subs in for loop

3 ビュー (過去 30 日間)
ben
ben 2018 年 2 月 10 日
編集済み: ben 2018 年 2 月 10 日
Hi,
I have the following equation:
syms tf zeta taum tgo
eq = (exp(-tgo/taum)+tgo/taum-1)^2;
INT = int(eq,tgo);
TauM = 5;
dt = 0.01;
Tgo = 10;
for Tgo > 0
INT = double(subs(INT,{tgo,taum},{Tgo,TauM}));
Tgo = Tgo - dt
end
My question is: using subs inside the for loop slows it down. Is there anyway to make it faster? (The problem is Tgo is dynamic).
P.s. In this example I could write the integral not a syms however in many problems I would like to insert the function and run the code and not to do all the work before.
Thank you.

回答 (0 件)

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by