필터 지우기
필터 지우기

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

채택된 답변

Walter Roberson
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);
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
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)

추가 답변 (1개)

shunmugam hemalatha
shunmugam hemalatha 2021년 1월 4일
Even i couldn't find answer for the same.
clc
clear all
c0=40;
cd=50;
y0=0.09;
h=0.7;
r=5;
u=0.05;
a=260;
b=0.1;
syms T tow
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))';
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)
  댓글 수: 2
Walter Roberson
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
Walter Roberson 2021년 1월 4일
Your code here has the same problem as before, that you have more ( than you have )

댓글을 달려면 로그인하십시오.

카테고리

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