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.

 採用された回答

Walter Roberson
Walter Roberson 2020 年 8 月 2 日

0 投票

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
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
Walter Roberson
Walter Roberson 2020 年 8 月 2 日
Eg=int(Es, TETA, 0, TETAmax)
sajjad barzigar
sajjad barzigar 2020 年 8 月 3 日
thanks
sajjad barzigar
sajjad barzigar 2020 年 8 月 3 日
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
Walter Roberson
Walter Roberson 2020 年 8 月 4 日
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
sajjad barzigar
sajjad barzigar 2020 年 8 月 4 日
THANK YOU SO MUCH.
sajjad barzigar
sajjad barzigar 2020 年 8 月 4 日
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?
Walter Roberson
Walter Roberson 2020 年 8 月 4 日
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.
sajjad barzigar
sajjad barzigar 2020 年 8 月 4 日
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 ?
Walter Roberson
Walter Roberson 2020 年 8 月 4 日
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.
sajjad barzigar
sajjad barzigar 2020 年 8 月 4 日
normaly between 12 to 20 i think.but they didnt mention any kind of valid range for the answer.
sajjad barzigar
sajjad barzigar 2020 年 8 月 4 日
any way thank you for every thing :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by