Using symbolic subs in for loop

조회 수: 4 (최근 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 CenterFile Exchange에서 Conversion 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