フィルターのクリア

solve equation with symbolic variables

3 ビュー (過去 30 日間)
Milan
Milan 2022 年 12 月 21 日
回答済み: Paul 2022 年 12 月 21 日
Hello, I was trying to solve the equation with 'c' is a variable, and trying to get 'c' equating equation to zero. But I am getting error. Can anyone help with this please:
syms c;
c0 = 53.6;
Re = 102.5; % external radious of column
D = 2*Re;
cov = 20;
Rc = Re - cov;
ec0 = 0.00076+((0.626*fc0-4.33)*10^-7)^0.5;
Ec = 5000*sqrt(fc0);
beta = Ec/fc0-1/ec0; %relation between Ec and secant of Ec
fyl = 640;
Esl = 2e5;
b = 0.01;
ey = fyl/Esl;
dsl = 12; %long rebar dia
fyt = 437;
Est = 2e5;
eults = 0.1;
dst = 10;
Ef = 4.5e4;
fultf = 884.6;
eff = 0.67;
eultf = eff*fultf/Ef;
s= 60;
tf = 1.58;
eccu = 0.1;
nbars = 6;
Asl =0.25*pi*dsl^2;
ey= fyl/Esl;
ecu = 0.003;
d_1= cov + dst+dsl/2;
d_2 = 102.5;
d_3 = 169;
es3 = ey;
% c = d_3/(ecu+es3);
beta1 = 0.667;
a = @(c) beta1*c;
theta = @(c) acos((0.5*D-a(c))/0.5*D);
A_comp = @(c) (D^2)*(((theta(c)*3.14/180)-sin(theta(c))*cos(theta(c)))/4);
C_c = @(c) 0.85*fc0*A_comp(c);
y_bar = @(c) (D^3)*(sin(theta(c)))^3/(12*A_comp(c));
fs3 = fyl;
Fs3 = -fs3*2*Asl;
es2 = @(c) (c-d_2)*ecu/c ;
Fs2 = @(c) es2*Esl*2*Asl;
es1 = @(c) (c-d_1)*ecu/c;
Fs1 = @(c) es1*Esl*2*Asl;
F (c) = C_c(c)+Fs1(c)+Fs2(c)+Fs3;
eq1 = F(c) == 0;
c_solve = fsolve(eq1,c)

回答 (2 件)

Torsten
Torsten 2022 年 12 月 21 日
c0 = 53.6;
Re = 102.5; % external radious of column
D = 2*Re;
cov = 20;
Rc = Re - cov;
fc0 = 10;
ec0 = 0.00076+((0.626*fc0-4.33)*10^-7)^0.5;
Ec = 5000*sqrt(fc0);
beta = Ec/fc0-1/ec0; %relation between Ec and secant of Ec
fyl = 640;
Esl = 2e5;
b = 0.01;
ey = fyl/Esl;
dsl = 12; %long rebar dia
fyt = 437;
Est = 2e5;
eults = 0.1;
dst = 10;
Ef = 4.5e4;
fultf = 884.6;
eff = 0.67;
eultf = eff*fultf/Ef;
s= 60;
tf = 1.58;
eccu = 0.1;
nbars = 6;
Asl =0.25*pi*dsl^2;
ey= fyl/Esl;
ecu = 0.003;
d_1= cov + dst+dsl/2;
d_2 = 102.5;
d_3 = 169;
es3 = ey;
% c = d_3/(ecu+es3);
beta1 = 0.667;
a = @(c) beta1*c;
theta = @(c) acos((0.5*D-a(c))/0.5*D);
A_comp = @(c) (D^2)*(((theta(c)*3.14/180)-sin(theta(c))*cos(theta(c)))/4);
C_c = @(c) 0.85*fc0*A_comp(c);
y_bar = @(c) (D^3)*(sin(theta(c)))^3/(12*A_comp(c));
fs3 = fyl;
Fs3 = -fs3*2*Asl;
es2 = @(c) (c-d_2)*ecu/c ;
Fs2 = @(c) es2(c)*Esl*2*Asl;
es1 = @(c) (c-d_1)*ecu/c;
Fs1 = @(c) es1(c)*Esl*2*Asl;
F = @(c)C_c(c)+Fs1(c)+Fs2(c)+Fs3;
c0 = 10.0;
c_solve = fsolve(F,c0)
Equation solved, solver stalled. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared and the vector of function values is near zero as measured by the value of the function tolerance.
c_solve = 1.5367e+02 + 8.3812e-15i

Paul
Paul 2022 年 12 月 21 日
Hi Milan
With a mix of syms and anonymous functions and a call to fsolve using a symbolic equation, I wasn't sure if the desire was to solve the problem numericall or using symbolic stuff.
Here's the code using just symbolic math. One variable had to be defined, so I just made up a value.
syms c;
c0 = 53.6;
Re = 102.5; % external radious of column
D = 2*Re;
cov = 20;
Rc = Re - cov;
% pick a value for fc0
fc0 = 100;
ec0 = 0.00076+((0.626*fc0-4.33)*10^-7)^0.5;
Ec = 5000*sqrt(fc0);
beta = Ec/fc0-1/ec0; %relation between Ec and secant of Ec
fyl = 640;
Esl = 2e5;
b = 0.01;
ey = fyl/Esl;
dsl = 12; %long rebar dia
fyt = 437;
Est = 2e5;
eults = 0.1;
dst = 10;
Ef = 4.5e4;
fultf = 884.6;
eff = 0.67;
eultf = eff*fultf/Ef;
s= 60;
tf = 1.58;
eccu = 0.1;
nbars = 6;
Asl =0.25*pi*dsl^2;
ey= fyl/Esl;
ecu = 0.003;
d_1= cov + dst+dsl/2;
d_2 = 102.5;
d_3 = 169;
es3 = ey;
% c = d_3/(ecu+es3);
beta1 = 0.667;
a(c) = beta1*c;
theta(c) = acos((0.5*D-a(c))/0.5*D);
A_comp(c) = (D^2)*(((theta(c)*3.14/180)-sin(theta(c))*cos(theta(c)))/4);
C_c(c) = 0.85*fc0*A_comp(c);
y_bar(c) = (D^3)*(sin(theta(c)))^3/(12*A_comp(c));
fs3 = fyl;
Fs3 = -fs3*2*Asl;
es2 = (c-d_2)*ecu/c ;
Fs2(c) = es2*Esl*2*Asl;
es1 = (c-d_1)*ecu/c;
Fs1(c) = es1*Esl*2*Asl;
F(c) = C_c(c)+Fs1(c)+Fs2(c)+Fs3;
eq1 = F(c) == 0
eq1 = 
%c_solve = fsolve(eq1,c)
c_solve = solve(eq1,c)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
c_solve = 
153.66950675498669257728082924307

Community Treasure Hunt

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

Start Hunting!

Translated by