How to Solve with subs

6 次查看(过去 30 天)
I am trying to first solve for Tau first, and then plug the known value back in and solve for y(t) @ 1.5 seconds.
it is given that @ y(1.2)=80.
clear;clc;
syms T %Tau
syms yt
t=1.2;
y0=0;
KA=100; %steady response
U_t=(y0-KA)*exp(-t/T); %transient response
y_t=80; %given that y(t), if y(1.2)=80
eq3_5a=y_t==KA+U_t
Tau=vpasolve(eq3_5a,T)
subs(U_t,T,Tau)
eq3_5b=yt==KA+U_t
solve(eq3_5b,yt)

采纳的回答

VBBV
VBBV 2022-2-18
clear;clc;
syms T yt
t=1.2;
y0=0;
KA=100; %steady response
U_t=(y0-KA)*exp(-t/T) %transient response
U_t = 
y_t=80; %given that y(t), if y(1.2)=80
eq3_5a=y_t==KA+U_t
eq3_5a = 
Tau=vpasolve(eq3_5a,T)
Tau = 
0.74560192147153417284863926581669
subs(U_t,T,Tau)
ans = 
eq3_5b=yt==KA+U_t
eq3_5b = 
Yt = solve(eq3_5b,yt)
Yt = 
vpa(subs(Yt,T,1.5),4)
ans = 
55.07
  5 个评论
VBBV
VBBV 2022-2-18
编辑:VBBV 2022-2-18
clear;clc;
syms T yt t
% t=1.2;
y0=0;
KA=100; %steady response
U_t= (y0-KA)*exp(-t/T) %transient response
U_t = 
y_t=80; %given that y(t), if y(1.2)=80
eq3_5a=y_t==KA+U_t;
Tau=vpasolve(subs(eq3_5a,t,1.2),T)
Tau = 
0.74560192147153417284863926581669
subs(U_t,T,Tau);
eq3_5b=yt==KA+U_t
eq3_5b = 
Yt = solve(eq3_5b,yt);
vpa(subs(Yt,[T t],[Tau 1.5]),4)
ans = 
86.63
Ok, It is possible to Subs 2 variables like above
Kyle Langford
Kyle Langford 2022-2-25
Sweet. Thanks! I tried to do something similar using {} but it didn't work. I see i was using the wrong characters.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by