how can i solve this error
显示 更早的评论
i writed this code and i want to integral the sum of Egb and Egs but i get this error
Error using integral (line 82)
First input argument must be a function handle.
and this error
Error in figure (line 28)
Eg=integral(Egs+Egb,0,TETAmax,TETA);
this is the code
clc
clear all
syms TETA
S0=613e9;
Sp=3.7e9;
Rin=27.5e-3;
Rout=31.5e-3;
h=15e-3;
for t=0.001:0.0001:0.0014;
TETAmax=-3.661*((h/t)^-1.14)+2.589;
DELTAmax=h-t-(h/(2*TETAmax));
R=Rin+(t/2);
Egb=pi*S0*(t^2)*((TETA*4*R)+h-(h*cos(TETA)))/((3^(0.5))*(TETA))
Egs=pi*S0*(h^2)*t*(TETA*sin(TETA)+cos(TETA)-1)/(2*(TETA)^2)
Eg=integral(Egs+Egb,0,TETAmax,TETA);
end
what is wrong?thank you for your help.
采纳的回答
integral() is reserved for numeric integration. You are doing integration of symbolic expression. You need to use int() or vpaintegral() for that.
12 个评论
sajjad barzigar
2020-8-2
编辑:sajjad barzigar
2020-8-2
i changed the code and now i am getting this error .what is the problem now?
Attempt to reference field of non-structure array.
Error in isAllVars (line 9)
res = strcmp(mupadmex('symobj::isAllVars',expr.s,0),'TRUE');
Error in sym/int (line 150)
if ~isscalar(x) || ~isAllVars(x)
Error in figure (line 32)
Eg=int(Es,0,TETAmax,TETA)
this is the code:
clc
clear all
syms TETA
S0=613e9;
Sp=3.7e9;
Rin=27.5e-3;
Rout=31.5e-3;
h=15e-3;
for t=0.001:0.0001:0.0014;
TETAmax=-3.661*((h/t)^-1.14)+2.589;
DELTAmax=h-t-(h/(2*TETAmax));
R=Rin+(t/2);
Egb=pi*S0*(t^2)*((TETA*4*R)+h-(h*cos(TETA)))/((3^(0.5))*(TETA));
Egbs=simplify(Egb);
Egs=pi*S0*(h^2)*t*(TETA*sin(TETA)+cos(TETA)-1)/(2*(TETA)^2);
Egss=simplify(Egs);
E=Egbs+Egss;
Es=simplify(E)
Eg=int(Es,0,TETAmax,TETA)
end
please help me .ty
Eg=int(Es, TETA, 0, TETAmax)
i want to plot the change in Eg base on the change in t and i used a for loop but it only shows me the Eg fot t=0.0014 but i need a vector so i can plot it.how can i solve this?
clc
clear all
syms TETA
S0=613e9;
Sp=3.7e9;
Rin=27.5e-3;
Rout=31.5e-3;
h=15e-3;
for t=0.001:0.0001:0.0014;
TETAmax=-3.661*((h/t)^-1.14)+2.589;
DELTAmax=h-t-(h/(2*TETAmax));
R=Rin+(t/2);
eg=pi*S0*t*(((3^0.5)*h^2)+2*h*t+4*pi*R*t)/(2*(3^0.5));
pg=eg/(h-2*t);
et=eg+pi*((Rin)^2)*Sp*(h-2*t);
pt=pg+pi*((Rin)^2)*Sp;
Egb=pi*S0*(t^2)*((TETA*4*R)+h-(h*cos(TETA)))/((3^(0.5))*(TETA));
Egbs=simplify(Egb);
Egs=pi*S0*(h^2)*t*(TETA*sin(TETA)+cos(TETA)-1)/(2*(TETA)^2);
Egss=simplify(Egs);
E=Egbs+Egss;
Es=simplify(E);
Eg=int(Es,TETA,0,TETAmax);
end
plot(t,Eg,'g')
grid on
thank you so much for your help
syms TETA
S0=613e9;
Sp=3.7e9;
Rin=27.5e-3;
Rout=31.5e-3;
h=15e-3;
tvals=0.001:0.0001:0.0014; %note this is only 5 values
num_t = length(tvals);
Eg = zeros(1, num_t, 'sym');
for tidx = 1 : num_t
t = tvals(tidx);
TETAmax=-3.661*((h/t)^-1.14)+2.589;
DELTAmax=h-t-(h/(2*TETAmax));
R=Rin+(t/2);
eg=pi*S0*t*(((3^0.5)*h^2)+2*h*t+4*pi*R*t)/(2*(3^0.5));
pg=eg/(h-2*t);
et=eg+pi*((Rin)^2)*Sp*(h-2*t);
pt=pg+pi*((Rin)^2)*Sp;
Egb=pi*S0*(t^2)*((TETA*4*R)+h-(h*cos(TETA)))/((3^(0.5))*(TETA));
Egbs=simplify(Egb);
Egs=pi*S0*(h^2)*t*(TETA*sin(TETA)+cos(TETA)-1)/(2*(TETA)^2);
Egss=simplify(Egs);
E=Egbs+Egss;
Es=simplify(E);
Eg(tidx) = int(Es,TETA,0,TETAmax);
end
Egn = double(Eg);
plot(tvals, Egn, 'g')
grid on
I would recommend that you consider using vpaintegral() instead of int(), and that you consider using more time points
THANK YOU SO MUCH.
i want to solve this equation and find teta as a function of t and h.how should i do this?
this is the equation:
(h/t)-(2*teta/(2*sin(teta)-1))=0
i should get this answer from matlab(TETA=-3.661*((h/t)^-1.14)+2.589).how can i get this answer from matlab?
Let h/t = 2 . Then your expression would give -3.661*(2)^-1.14)+2.589 which is about 0.927786186 .
However, 2-(2*teta/(2*sin(teta)-1)) does not have any root near 0.92: the only real root for it is -2.380061273 approximately.
Therefore you should not get that expression, whatever you do get.
i got this equation and the answer from this article(experimental and theoretical investigations on axial crushing of aluminum foam-filled grooved tube(Yao2019))which you can easily find in google scholar.
in this article in equation 5 and 6 you can see that the authur mentions that the answer to the equation is the answer that i mentioned before.i dont know i am wrong or they are because thats an approved and published article.they said by using matlab you can solve the equation and find the answer below.
(TETA=-3.661*((h/t)^-1.14)+2.589).
are they wrong or i am ?
What is the valid range of values for h/t ? Sometimes equations are approximately valid within a particular range of interest while being too wrong outside of the area of interest.
normaly between 12 to 20 i think.but they didnt mention any kind of valid range for the answer.
any way thank you for every thing :)
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Calculus 的更多信息
标签
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
