I need the Coding to solve the simultaneous equations. To find T, tow, TC.
조회 수: 2 (최근 30일)
이전 댓글 표시
lc
clear all
c0=40;
cd=50;
y0=0.09;
h=0.7;
r=5;
u=0.05;
a=260;
b=0.1;
x='((a*h)/2)+((a*r*T)/3)+((a*h*T*((exp(-u*tow))+b))/3+((a*r*(T^2)*(exp(-u*tow))+b))/8)-(c0/(T^2))+((cd*((3*a*y0*(exp(-u*tow)))-2(2*T*a*b*y0*(exp(-u*tow)))-(2*T*a*(b^2))/6)';
y='1-((u*a*h*(T^2)*y0*(exp(-u*tow)))/6)-((u*a*r*(T^3)*y0*(exp(-u*tow)))/24)-(cd*u*T*y0*(exp(-u*tow))*((3*a-a*b*T)/6))';
TC=(c0/T)+(1/T)*(((a*h*(T^2))/2)+((a*r*(T^3))/6)+((((a*(y0*(exp(-u*tow)))+b)/2))*(((h*(T^3))/3)+((r*(T^4))/12))))+((cd/T)*((((T^2)*y0*(exp(-u*tow))*(3*a-a*b*T))-(a*(b^2)*(T^3)))/6))+tow
댓글 수: 0
채택된 답변
Walter Roberson
2021년 1월 1일
You cannot solve that without fixing your formulas.
syms T tow
c0=40;
cd=50;
y0=0.09;
h=0.7;
r=5;
u=0.05;
a=260;
b=0.1;
A = a; %??? maybe ?
R = r; %??? maybe ?
B = b; %??? maybe ?
x = ((a*h)/2)+((a*r*T)/3)+((a*h*T*((exp(-u*tow))+b))/3+((a*r*(T^2)*(exp(-u*tow))+b))/8)-(c0/(T^2))+((cd*((3*a*y0*(exp(-u*tow)))-2*(2*T*a*b*y0*(exp(-u*tow)))-(2*T*a*(b^2))/6);
12 1 0 12 1 0 12 34 5 43 21 23 4 3 4 5 43 21 0 1 2 10 12 34 5 6 543 4 5 6 543 4 5 43 2
You have two more ( than you have )
y = 1-((u*a*h*(T^2)*y0*(exp(-u*tow)))/6)-((u*a*r*(T^3)*y0*(exp(-u*tow)))/24)-(cd*u*T*y0*(exp(-u*tow))*((3*a-a*b*T)/6));
sol = solve([x,y], [T tow]);
T = sol.T;
tow = sol.tow;
TC = (c0/T)+(1/T)*(((a*h*(T^2))/2)+((a*r*(T^3))/6)+((((a*(y0*(exp(-u*tow)))+b)/2))*(((h*(T^3))/3)+((r*(T^4))/12))))+((cd/T)*((((T^2)*y0*(exp(-u*tow))*(3*a-a*b*T))-(a*(b^2)*(T^3)))/6))+tow;
disp(T)
disp(tow)
disp(TC)
vpa(T)
vpa(tow)
vpa(TC)
댓글 수: 0
추가 답변 (1개)
shunmugam hemalatha
2021년 1월 4일
댓글 수: 2
Walter Roberson
2021년 1월 4일
Using solve with quoted strings has not been valid for several releases, and has not been a good idea since 2016 (there were some bugs then that forced using quoted strings for certain differential equations... for nearly any purpose other than differential equations, using quoted strings for symbolic expressions has not been a good idea since r2014a.
I posted the version without quoted strings already and you should have built on that.
Walter Roberson
2021년 1월 4일
Your code here has the same problem as before, that you have more ( than you have )
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!