How to define transfer variables when solving equations in 1stOpt?

3 次查看(过去 30 天)
I am trying to solve a non-linear integration equations in 1stOpt. The parameters to be solved are x1, y1, Uratio, and 5 transfer variables are used to build the equations: Left, Right, C, pl, pr.
============================
Problems
1 The code doesn't run at all
2 I don't know how to difine the transfer variables
3 I'm not sure the use of int() is correct
Original code
=============================
Constant alph=pi*15/180, L=0.116, Tice=18, addweight=0.212, T0=15, dL=-0.02, tilt=0.1, heightofweight=12.5, forcefromcable=0, muL=0.001, rhoS=920*0.95, rhoL=1000, Cps=2049.41, hm=334000+Cp_s*T_ice, KL=0.57, Pe=102770, g1=-addweight*9.8, g2=-0.38*9.8, heightofmasscenter=0.07, heightofcable=0.13, d = pi*L*sin(alph)/2, M = g1*(dL*cos(tilt)+heightofweight*sin(tilt))-g2*heightofmasscenter*sin(tilt)-forcefromcable*heightofcable*sin(tilt), G = g1+g2;
Parameter x1[0,], y1[,0], Uratio;
//transfer variables
Left = x1^2+y1^2-2*x*(x1*sin(alph)-y1*cos(alph)+x^2);
Right = x1^2+y1^2-2*x*(x1*sin(alph)+y1*cos(alph)+x^2);
C = (int(x*Right^2,x=0:L)-int(x*Left^2,x=0:-L))/(int(Left^1.5,x=0:-L)-int(Right^1.5,x=0:L));
pl = 12*muL*rhoS^4*hm^3*Uratio^4*(int(x*Left^2,x=y:-L)+C*int(Left^1.5,x=y:-L))/(rhoL*T0^3*KL^3)+Pe;
pr = 12*muL*rhoS^4*hm^3*Uratio^4*(int(x*Right^2,x=y:L)+C*int(Right^1.5,x=y:L))/(rhoL*T0^3*KL^3)+Pe;
Function int(pl*y,y=-L:0)+int(pr*y,y=0:L)+M/d=0;
int(pl,y=-L:0)*sin(alph+tilt)+int(pr,y=0:L)*sin(alph-tilt)+G/d-2*L*Pe*sin(alph)*cos(tilt)=0;
int(pl,y=-L:0)*cos(alph+tilt)-int(pr,y=0:L)*cos(alph-tilt)+2*L*Pe*sin(alph)*sin(tilt)=0;

回答(1 个)

Animesh
Animesh 2023-8-21
Hello Yuting,
To solve a system of non-linear integration equations in MATLAB, you can use the fsolve function from the Optimization Toolbox.
Thanks,
Animesh Jha

类别

Help CenterFile Exchange 中查找有关 Nonlinear Optimization 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by