how to fix error occurred converting from tf to double:

The following error occurred converting from tf to double:
Conversion to double from tf is not possible.
Error in constrValidate (line 55)
Iterate.cineq(:) = cineq;
Error in gacommon (line 125)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, ...
Error in gamultiobj (line 289)
~,options] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub,nonlcon,[],options,user_options);

Answers (1)

It looks like your nonlinear inequality constraints use tf() and try to return the tf(). If you need to use tf() in your computation, rememberthat you need to invoke the transfer function on data, or you need to do something like bode().
tf() is most typically used to create vectors, rather than being evaluated at a single point, so you might need some work in condensing the vector of results into a small number of constraints.

3 Comments

function[Cineq,Ceq]=nonlcon(x)
L=50000; W=3500;
At = 3500*x(2) + 100*x(5) - 100*x(6) - x(4)*(2*x(5) - 3500) + 2*x(6)*(x(1) - x(2)) + 10000;
Ytot =(10000*x(2) + (100*x(5) - 100*x(6))*(x(2) + 100/3) + 1750*x(2)^2 + 2*x(6)*(x(1)/2 + x(2)/2)*(x(1) - x(2)) - x(4)*(2*x(5) - 3500)*(x(1) - x(4)/2) + 1000000/3)/(3500*x(2) + 100*x(5) - 100*x(6) - x(4)*(2*x(5) - 3500) + 2*x(6)*(x(1) - x(2)) + 10000);
Ixx =(500000*x(5))/3 - (500000*x(6))/3 - (x(4)^3*(2*x(5) - 3500))/12 + 10000*(x(2) - (10000*x(2) + (100*x(5) - 100*x(6))*(x(2) + 100/3) + 1750*x(2)^2 + 2*x(6)*(x(1)/2 + x(2)/2)*(x(1) - x(2)) - x(4)*(2*x(5) - 3500)*(x(1) - x(4)/2) + 1000000/3)/(3500*x(2) + 100*x(5) - 100*x(6) - x(4)*(2*x(5) - 3500) + 2*x(6)*(x(1) - x(2)) + 10000) + 100/3)^2 + 3500*x(2)*(x(2)/2 - (10000*x(2) + (100*x(5) - 100*x(6))*(x(2) + 100/3) + 1750*x(2)^2 + 2*x(6)*(x(1)/2 + x(2)/2)*(x(1) - x(2)) - x(4)*(2*x(5) - 3500)*(x(1) - x(4)/2) + 1000000/3)/(3500*x(2) + 100*x(5) - 100*x(6) - x(4)*(2*x(5) - 3500) + 2*x(6)*(x(1) - x(2)) + 10000))^2 + (875*x(2)^3)/3 + 2*(50*x(5) - 50*x(6))*(x(2) - (10000*x(2) + (100*x(5) - 100*x(6))*(x(2) + 100/3) + 1750*x(2)^2 + 2*x(6)*(x(1)/2 + x(2)/2)*(x(1) - x(2)) - x(4)*(2*x(5) - 3500)*(x(1) - x(4)/2) + 1000000/3)/(3500*x(2) + 100*x(5) - 100*x(6) - x(:,4)*(2*x(:,5) - 3500) + 2*x(:,6)*(x(:,1) - x(:,2)) + 10000) + 100/3)^2 + (x(:,6)^3*(x(:,1) - x(:,2)))/6 + 2*x(:,6)*(x(:,1) - x(:,2))*(x(:,1)/2 + x(:,2)/2 - (10000*x(:,2) + (100*x(:,5) - 100*x(:,6))*(x(:,2) + 100/3) + 1750*x(:,2)^2 + 2*x(:,6)*(x(:,1)/2 + x(:,2)/2)*(x(:,1) - x(:,2)) - x(:,4)*(2*x(:,5) - 3500)*(x(:,1) - x(:,4)/2) + 1000000/3)/(3500*x(:,2) + 100*x(:,5) - 100*x(:,6) - x(:,4)*(2*x(:,5) - 3500) + 2*x(:,6)*(x(:,1) - x(:,2)) + 10000))^2 - x(:,4)*(2*x(:,5) - 3500)*(x(:,4)/2 - x(:,1) + (10000*x(:,2) + (100*x(:,5) - 100*x(:,6))*(x(:,2) + 100/3) + 1750*x(:,2)^2 + 2*x(:,6)*(x(:,1)/2 + x(:,2)/2)*(x(:,1) - x(:,2)) - x(:,4)*(2*x(:,5) - 3500)*(x(:,1) - x(:,4)/2) + 1000000/3)/(3500*x(:,2) + 100*x(:,5) - 100*x(:,6) - x(:,4)*(2*x(:,5) - 3500) + 2*x(:,6)*(x(:,1) - x(:,2)) + 10000))^2 + 8947848533333333/536870912;
%%%%%%% step 2 Material selection
%permisible concrete stress (fa) and permisible tensile stress (fta)
fc=50;
fa=0.6*fc;
fta=0.5*fc^0.5;
%Moment requered to produce the permissible compresive stress at bottom most fiber of the girder
c1=Ytot;
c2=x(1)-Ytot;
%unit density of a concrete(rc) ,refer AASHTO table 3.5.1.1 in kg/mm3
rc=2320*10^-9;
g=9.81;
%%%%%%%step 3 dead load due to the self waight of concrete (PDL1)
PDL1=At*rc*g;
%barrier rail weight acting at service stage after all loos is 11.5N/mm
Pb=11.5;
%thickness of the wearing surface of 75mm
twer=75;
% distributed load of the wearing serface having density of 2250kg/m3
rw=2250*10^-9;
Wb=200;
DW=(W-2*Wb)*twer*rw*g;
%total dead load due to unfactured self weaight ,barier and wearing weight
PDL=PDL1+DW+Pb;
%determination of the live load LL and dynamic load allowance IM
%AASHTO-3.6.2.1 state that dynamic load allowance shall not be applied to
%pedistrian loads or IM=1.0 should be used
%and for bridge only for pedistrian and biycle traffic shall be designed
%for a live load of 4.1*10^3 pa
PLL=4.1;
% for pedistrian load we will not concider IM
%load combianation
%service IIIcheck tensile stresss in prestressed concrete component
Q2=1.00*(PDL)+0.80*(PLL);
%The mid span bending moment due to the applied load at service limit stateI
M=(Q2*L^2)/8;
Mbc=(fa*Ixx)/c2;
%Moment requered to produce the permissible tensile stress at bottom most fiber of the girder
Mbt=-(fta*Ixx)/c2;
%Moment requered to produce the permissible compresive stress at top most fiber of the girder
Mtc=(fa*Ixx)/c1;
%Moment requered to produce the permissible tension stress at top most fiber of the girder
Mtt=-(fta*Ixx)/c1;
%Tensile strength , for most concretes the direct tensile strength fr=0.62*fc^0.5 ,
%for prestressing strands the tensile straingth is fpu= 1860MPA
fpu=1860;
fy=420;
%yield strength for strand is given by 0.9*fpu for low relaxiation strand
fpy=0.9*fpu;
%modules of elasticity for steel reinforcement shall be assumed
%Es=200,000MPa , for presstressong strand Ep=197,000MPa
Es=200000;
Ep=197000;
%modules of elasticity of concrete
Ec=4800*(fc^0.5);
%unit density of a concrete(rc) ,refer AASHTO table 3.5.1.1 in kg/mm3
rc=2320*10^-9;
g=9.81;
%%%%%%%step 3 dead load due to the self waight of concrete (PDL1)
PDL1=At*rc*g;
%barrier rail weight acting at service stage after all loos is 11.5N/mm
Pb=11.5;
%thickness of the wearing surface of 75mm
twer=75;
% distributed load of the wearing serface having density of 2250kg/m3
rw=2250*10^-9;
Wb=200;
DW=(W-2*Wb)*twer*rw*g;
%total dead load due to unfactured self weaight ,barier and wearing weight
PDL=PDL1+DW+Pb;
%determination of the live load LL and dynamic load allowance IM
%AASHTO-3.6.2.1 state that dynamic load allowance shall not be applied to
%pedistrian loads or IM=1.0 should be used
%and for bridge only for pedistrian and biycle traffic shall be designed
%for a live load of 4.1*10^3 pa
PLL=4.1;
% for pedistrian load we will not concider IM
%load combianation
% service I check compressive stress in prestressed concrete component for
Q1=1.00*(PDL)+1.00*(PLL);
%service IIIcheck tensile stresss in prestressed concrete component
Q2=1.00*(PDL)+0.80*(PLL);
%check resistance for strength I
Q3=1.25*(PDL)+1.5*DW+1.75*(PLL);
%%%%%%% Determining the prestressing force
% the efficiency of the cross section p
P=Ixx/(At*Ytot*(x(1)-Ytot));
%permisible concrete stress (fa) and permisible tensile stress (fta)
fa=0.6*fc;
fta=0.5*fc^0.5;
%Moment requered to produce the permissible compresive stress at bottom most fiber of the girder
c1=Ytot;
c2=x(1)-Ytot;
%The mid span bending moment due to the applied load at service limit stateI
M=(Q2*L^2)/8;
%moment due to the own weight at mid span
MD=((PDL1+Pb)*L^2)/8;
%moment due to the wearing serface at mid span
Mw=((DW)*L^2)/8;
%moment due to the live load at mid span
ML=((PLL)*L^2)/8;
% the center of gravity o the strand at mid span is assumed to be located
% at 5% of the girder heignt
ybs=x(1)*0.05;
e=x(1)-ybs;
%the preliminary prestressing force is usually determined on the basis of the service limit state III load condition at mid span
x(7)=(M+Mbt)/(P*c1+e);
%Area of the strand (Ast)having tensile stangth of 1860 Mpa and 15.24diameter and
%Area requered dor the given value of prestressing force (Aps),number of strands requered (N)
Ast=((15.24)^2*pi)/4;
Aps=x(7)/fpy;
N=Aps/Ast;
%%%%%%%step 5 , calculate prestress loss
%1 friction loss fpf , AASHTO art.5.9.5.2.2b
%ep is the distance b/n two centroid points Lp is the horizontal distance
%b/n two control points , K is the web friction coefficient 0.0002 ,
%U is the coefficient of friction 0.25
fpj=0.9*fpu;
K=0.0002;
U=0.25;
ep=e;
Lp=0.5*L;
a=2*ep/Lp;
b=780;
fpf=fpj*(1-(exp(-(K*b+U*a))));
%2 Anchorage set loss fpa
%for an anchor set thickness of L1=10mm and E=200,000mpa ,Lpf=50m
Lpf=50000;
L1=10;
Lpa=(Ec*L1*Lpf/fpf)^0.5;
%3 elastic shortning loss fpes AASHTO 5.9.5.3.b
%fcgp=(F/A)+(F*e^2/Ixx)+(M*e/Ixx) , where M is the moment due to own weight,
%fcgp is the sum of the concrete stress at the center of graity of the
%prestressing force after jacking for post tensioned member, for simply
%supported structure calculated at the center section of the span
fcgp=(x(7)/At)+(x(7)*e^2/Ixx)+((MD+Mw)*e/Ixx);
fpes=(N-1)*Ep*fcgp/(2*N*Ec);
%4 time dependant loss
%AASHTO provides s tsble to estimate the accumulated effect of time dependant
%lossed resulting from the creep and shrinkage of concrete and relaxation of
%the steel tedons .there for fptm=145MPa
fptm=145;
fpt=fpf+fpes+fptm;
% To determone the jacking force Pj, after loss the initial prestress force
% coefficient Fpci and final prestress coefficient Fpcf
Fpcf=1-(fpt/fpj);
%the requered prestressing force at transfer (befor any loss)
Pi=x(7)/Fpcf;
Aps1=Pi/fpy;
%%check prestressing stress limit at service limit state
%the initial stress in prestressing steel before transfer <=0.75*fpu
fpbt=0.75*fpu;
fpe=fpbt-fpt;
%check concret stress for service limit state
%checking concrete stress for service limite state
%Stress at the top of CIP box girder (ftop) due to the own weight should be <fa =0.6*fc Mpa
ftop=(MD+Mw)*c1/Ixx;
%% check concrte strength at sevice limit state I at bottom fiber after loss
M1=Q1*L^2/8;
fcsb=Fpcf*Pi/At +Fpcf*Pi*e*c2/Ixx -M1*c2/Ixx;
% Check tensile stresses at bottom of the girder under service III
% fbot<fta
M2=Q2*L^2/8;
fbot=(Pi*Fpcf/At)+(Fpcf*Pi*e*c2/Ixx)-(M2*c2/Ixx);
%%%%%% step 6 Design for strength limite state-flexure
%Maximum factored moment Mu
Mu=1.25*MD+1.5*Mw+1.75*ML;
%Average prestressing steel stress
fpy=0.9*fpu;
fs=fy;
K=2*(1.04-(fpy/fpu));
dp=x(1)-0.05*x(1);
cc=25;
d=16;
ds=x(1)-cc-d/2;
As=(0.85*fc*W*x(1)-((0.85*fc*W*x(1))^2 -1.7*fc*W*Mu)^0.5)/fy;
Asmin=0.002*At;
B1=0.85-((0.05)*(fc-28)/7);
C=(Aps*fpu+As*fs)/(0.85*fc*B1*W+K*Aps*(fpu/dp));
a=B1*C;
fpy=0.9*fpu;
K=2*(1.04-(fpy/fpu));
fps=fpu*(1-(K*C/dp));
de=(Aps*fps*dp+As*fy*ds)/(Aps*fps+As*fy);
%%factored moment resistance
Mn=(Aps*fps*(dp-0.5*a)+As*fy*(dp-0.5*a));
dt=x(1)-0.05*x(1);
et=0.0030*(dt-C)/C;
%%%% minimum reinforcement
%%the amounte of prestressed tensile reinforcement at any section requeres that
%%flexural resistance Mr, equals the leasser of i,1.33*Mu and Mcr
fr=0.62*fc^0.5;
fpe1=(Pi/At)+(x(7)*e*c2/Ixx);
fd=(MD*+Mw)*c2/Ixx;
Mcr=Ixx*(fr+fpe1-fd)/Ytot;
Mr=min(Mcr,1.33*Mu);
%%%% step-7 design for shear-strength limit state I
Vu=0.95*Q3*L;
dva=[(de-0.5*a) (0.9*de) (0.72*x(1))];
dv=min(dva);
O=atan((e/(0.5*L)));
Vp=Pi*sind(O*180/pi);
fpo=0.7*fpu;
Nu=0;
ex=(((Mu/dv)+0.5*Nu+abs(Vu-Vp)-Aps*fpo))/(Es*As+Ep*Aps1);
es=ex;
B=4.8/(1+750*ex);
tt=29+3500*es;
%%AASHTO 5.8.3.4.2.3
%%concrete contribution for shear
bv=0.2*x(6);
Vc=0.083*B*(fc)^0.5*bv*dv;
%% requerment for shear reinforcement
q=0.9; %q=0.9 for shear prestressed structures
Vs=(Vu/q)-Vc-Vp;
Av=390;
S=Av*fy*dv*cotd(tt)/Vs;
%Checking the maximum spacing of shear reinforcement
VU=abs(Vu-q*Vp)/(q*bv*dv);
if VU<0.125*fc
Smax=min(0.8*dv,600);
elseif VU>0.125*fc
Smax=min(0.4*dv,300);
end
if S>Smax
S=Smax;
elseif S<Smax
S=S;
end
VS=Av*fy*dv*(cotd(tt))/S;
%Nominal shear resistance
Vn=min((Vc+Vs+Vp),0.25*fc*dv*dv+Vp);
%assuming a parabolic tendon layout
Mc=Pi*e;
%%check longitudinal reinforcement requirement
Vs=(Vu/q)-Vc-Vp;
qf=1.0;
qv=0.9;
%As opposed to load deflection, camber is usually referred to as reversed deflection and is caused by prestressing.
DD=((L^2)*(5*Mc))/(8*Ec*Ixx*6);
%deflection due to the applied load(gravity load)
D1=(5*Q1*L^4)/(384*Ec*Ixx);
DT=D1-DD;
Cineq=[sqrt(M/(0.27*W*fc))-x(1),ftop-fa,fcsb-0.45*fc,fbot-0.5*((fc)^0.5),fbot-fta,Asmin-As,tf-C,0.65-B1,Lpf-Lpa,0.5*fpu-fps, C/de-0.42,0.005-et,Mr-Mn,abs((Vu-Vp)*dv)-Mu,Vs-VS,Vu/q-Vn,(abs(Mu)/dv*qf)+(abs((Vu/qv)-Vp)-0.5*Vs)*cot(tt)-(Aps*fps+As*fy)*DT-L/360,0.5*q*(Vc+Vp)-Vu,Vu/q-Vn,fpe-0.8*fpy];
Ceq=[];
end
this is my nonlinear script
so how do i fix this???
how do i invoke the transfer function on data, or do something like bode().
Look right near the end
Cineq=[sqrt(M/(0.27*W*fc))-x(1),ftop-fa,fcsb-0.45*fc,fbot-0.5*((fc)^0.5),fbot-fta,Asmin-As,tf-C,0.65-B1,Lpf-Lpa,0.5*fpu-fps, C/de-0.42,0.005-et,Mr-Mn,abs((Vu-Vp)*dv)-Mu,Vs-VS,Vu/q-Vn,(abs(Mu)/dv*qf)+(abs((Vu/qv)-Vp)-0.5*Vs)*cot(tt)-(Aps*fps+As*fy)*DT-L/360,0.5*q*(Vc+Vp)-Vu,Vu/q-Vn,fpe-0.8*fpy];
^^
tf is Transfer Function from the Control System toolbox.
I do not see anything similar enough in the variables to be able to guess what you really wanted instead.

Sign in to comment.

Categories

Find more on Stress and Strain in Help Center and File Exchange

Products

Release

R2018a

Tags

Asked:

on 26 Apr 2021

Commented:

on 2 May 2021

Community Treasure Hunt

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

Start Hunting!