MATLAB Answers

Undefined operator '/' for input arguments of type 'function_handle'

2 ビュー (過去 30 日間)
Shimon Katzman
Shimon Katzman 2019 年 12 月 8 日
コメント済み: Shimon Katzman 2019 年 12 月 8 日
Hi everyone.
Cant find the problem in the function :(((
b=400; %mm
d=500; %mm
Asv = [3000 5000 3000 5000]; %mm^2
fckv = [30 30 90 90]; %Mpa
num_fckv = numel(fckv);
fsolve_opts = optimoptions('fsolve','Display','off');
c0 = 100;
tic
for k = 1:num_fckv
fck = fckv(k);
Ecshah=57000/145*(fck*145)^0.5; %Mpa
Es=200000; %Mpa
Esh=8500; %Mpa
fy=500; %Mpa
fsu=750; %Mpa
epssh=0.009;
epssu=0.075;
eps0=1.027*10^-7*fck*145+0.00195;
kshah=0.025*fck*10^3;
A=Ecshah*eps0/fck;
P=Esh*((epssu-epssh)/(fsu-fy));
epsy=fy/Es;
As = Asv(k);
%Values at yield
epssAtMy= epsy;
epscmAtMy=@(cAtMy) epssAtMy*cAtMy./(d-cAtMy);
funCshahAtMy=@(epsc) (1-(1-epsc./eps0).^A) .* (epsc<=eps0) + exp(-kshah*(epsc-eps0).^1.15) .* (epsc>eps0);
compressionAtMy=@(cAtMy) b*fck*cAtMy/epscmAtMy(cAtMy)*integral(funCshahAtMy,0,epscmAtMy(cAtMy))/1000;
%compressionAtMy=@(cAtMy) b*fck*cAtMy/epscmAtMy*integral(funCshahAtMy,0,epscmAtMy)/1000;
sigmaSteelAtMy= fy;
tensionAtMy= sigmaSteelAtMy*As/1000;
cAtMy(k)=fsolve(@(cAtMy) compressionAtMy(cAtMy)-tensionAtMy, c0, fsolve_opts)
c0=cAtMy(k);
funM=@(epsc) (1-(1-epsc./eps0).^A).*(d-cAtMy(k)+(cAtMy(k)./epscmAtMy).*epsc) .* (epsc<=eps0) + exp(-kshah*(epsc-eps0).^1.15).*(d-cAtMy(k)+(cAtMy(k)./epscmAtMy).*epsc) .* (epsc>eps0);
M(k)=b*fck*cAtMy(k)/epscmAtMy*integral(funM,0,epscmAtMy)/1000000
end
toc
Error:
Undefined operator '/' for input arguments of type 'function_handle'.
Error in Untitled (line 39)
M(k)=b*fck*cAtMy(k)/epscmAtMy*integral(funM,0,epscmAtMy)/1000000

  0 件のコメント

サインイン to comment.

採用された回答

Stephan
Stephan 2019 年 12 月 8 日
b=400; %mm
d=500; %mm
Asv = [3000 5000 3000 5000]; %mm^2
fckv = [30 30 90 90]; %Mpa
num_fckv = numel(fckv);
fsolve_opts = optimoptions('fsolve','Display','off');
c0 = 100;
tic
for k = 1:num_fckv
fck = fckv(k);
Ecshah=57000/145*(fck*145)^0.5; %Mpa
Es=200000; %Mpa
Esh=8500; %Mpa
fy=500; %Mpa
fsu=750; %Mpa
epssh=0.009;
epssu=0.075;
eps0=1.027*10^-7*fck*145+0.00195;
kshah=0.025*fck*10^3;
A=Ecshah*eps0/fck;
P=Esh*((epssu-epssh)/(fsu-fy));
epsy=fy/Es;
As = Asv(k);
%Values at yield
epssAtMy= epsy;
epscmAtMy=@(cAtMy) epssAtMy*cAtMy./(d-cAtMy);
funCshahAtMy=@(epsc) (1-(1-epsc./eps0).^A) .* (epsc<=eps0) + exp(-kshah*(epsc-eps0).^1.15) .* (epsc>eps0);
compressionAtMy=@(cAtMy) b*fck*cAtMy/epscmAtMy(cAtMy)*integral(funCshahAtMy,0,epscmAtMy(cAtMy))/1000;
%compressionAtMy=@(cAtMy) b*fck*cAtMy/epscmAtMy*integral(funCshahAtMy,0,epscmAtMy)/1000;
sigmaSteelAtMy= fy;
tensionAtMy= sigmaSteelAtMy*As/1000;
cAtMy(k)=fsolve(@(cAtMy) compressionAtMy(cAtMy)-tensionAtMy, c0, fsolve_opts)
c0=cAtMy(k);
funM=@(epsc) (1-(1-epsc./eps0).^A).*(d-cAtMy(k)+(cAtMy(k)./epscmAtMy(cAtMy(k))).*epsc) .* (epsc<=eps0) + exp(-kshah*(epsc-eps0).^1.15).*(d-cAtMy(k)+(cAtMy(k)./epscmAtMy(cAtMy(k))).*epsc) .* (epsc>eps0);
M(k)=b*fck*cAtMy(k)/epscmAtMy(cAtMy(k))*integral(funM,0,epscmAtMy(cAtMy(k)))/1000000
end
toc

  3 件のコメント

Shimon Katzman
Shimon Katzman 2019 年 12 月 8 日
Hi Stephan. i tryed it but it Errors:
Conversion to function_handle from double is not possible.
Error in Untitled3 (line 35)
M(k)=b*fck*cAtMy(k)/epscmAtMy(cAtMy(k))*integral(funM,0,epscmAtMy(cAtMy(k)))/1000000
Stephan
Stephan 2019 年 12 月 8 日
For me the code works free of errors:
cAtMy =
213.5338
M =
633.3242
cAtMy =
213.5338 283.4136
M =
633.3242 958.8101
cAtMy =
213.5338 283.4136 157.4791
M =
633.3242 958.8101 669.5751
cAtMy =
213.5338 283.4136 157.4791 195.2034
M =
1.0e+03 *
0.6333 0.9588 0.6696 1.0822
Elapsed time is 0.443724 seconds.
Shimon Katzman
Shimon Katzman 2019 年 12 月 8 日
Thank you Very much! i tryed it again and it worked.
Thank you

サインイン to comment.

その他の回答 (0 件)

サインイン してこの質問に回答します。

タグ


Translated by