how to solve the equation with loop?
1 view (last 30 days)
Show older comments
clc
clear all
T=15;
u1=8;
u2=12;
a1=50;
b1=5;
a2=100;
A=500;
Ae=100;
c1=5;
c2=10;
c3=12;
c4=8;
D=30;
b2=0.2;
a=0.01;
d=0.2;
k0=0.09;
k1=0.01;
h1e=2;
c1e=4;
%lambda=m
m=15;
%Cp=lambdae
Cp=0.02;
Cc=5000;
syms t
syms t1
syms x
pi=22/7;
f=a1+b1.*t;
g=a2.*(1/exp(b2.*t));
h=c1.*(t1./(1+m-t1))+(c2+Cp.*h1e).*int(((1+m-t)./(1+m-t1)),t,0,t1)+Cp.*c1e.*((1+m)./(1+m-t1))+c3.*(((t1-T).*k0)./(1+k1.*(t1-T)))+c4.*((k0./(1+k1.*(t1-T)))-1);
t11=vpasolve(h,t1,[0,10])
%double(subs(h,t1))
t11 = double(t11); % Convert symbolic to double
if 0<t11 && t11<=u1
S=int(((1+m)./(1+m-t)).*f,t,0,t11);
Q1=S+int((k0./(1+k1.*(t11-T)))*f,t,t11,u1)+(D.*k0./k1).*log((1+k1.*(u1-T))./(1+k1.*(u2-T)))+int((k0./(1+k1.*(t11-T)))*g,t,u2,T);
Q=subs(Q1, sym('t1'), t11);
vpa(Q)
DT=S-int(f,t,0,t11);
HT= int(int(((1+m-t)./(1+m-x)).*f,x,t,t11),t,0,t11);
BT=int((((T-t).*k0)./(1+k1.*(t-T))).*f,t,t11,u1)+int((((T-t).*k0)./(1+k1.*(t-T))).*g,t,u2,T)+(k0.*D./k1.^2).*log(1+k1.*(u2-T)./(1+k1.*(u1-T)))+(u1-u2).*(D.*k0./k1);
LT=int((1-(k0./(1+k1.*(t-T)))).*f,t,t11,u1)+int((1-(k0./(1+k1.*(t-T)))).*D,t,u1,u2)+int((1-(k0./(1+k1.*(t-T)))).*g,t,u2,T);
C1=(1/T).*(A+Cp.*Ae+c1.*DT+Cp.*c1e.*Q+(c2+Cp.*h1e).*HT+c3.*BT+c4.*LT-Cp.*Cc);
S1=subs(C1, sym('t1'), t11);
vpa(S1)
else
end
1 Comment
Constantino Carlos Reyes-Aldasoro
on 11 Apr 2024
Moved: Voss
on 11 Apr 2024
What is actually your question? What have you tried already?
Answers (0)
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!