Azzera filtri
Azzera filtri

I need the Coding to solve the simultaneous equations. To find T, tow, TC.

2 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Walter Roberson
Walter Roberson il 1 Gen 2021
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)

Più risposte (1)

shunmugam hemalatha
shunmugam hemalatha il 4 Gen 2021
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 Commenti
Walter Roberson
Walter Roberson il 4 Gen 2021
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 il 4 Gen 2021
Your code here has the same problem as before, that you have more ( than you have )

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by