How Can I solve this problem?

2 次查看(过去 30 天)
Dunker Yair Callo Roque
编辑: KSSV 2021-4-9
H = 3;
P = 100;
ls = atan(P/H);
fun = @(x) (2*(H/P)^2)*(x + (4/3)*x^3 + (17/15)*x^5 + (248/315)*x^7);
q = integral(fun,0,ls);
This is the error:
Error using ^ (line 51)
Incorrect dimensions for raising a matrix to a power. Check that the matrix is
square and the power is a scalar. To perform elementwise matrix powers, use
'.^'.
Error in distancia>@(x)(2.*(H/P)^2)*(x+(4/3)*x^3+(17/15)*x^5+(248/315)*x^7)
(line 4)
fun = @(x) (2.*(H/P)^2)*(x + (4/3)*x^3 + (17/15)*x^5 + (248/315)*x^7);
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in distancia (line 5)
q = integral(fun,0,ls);

回答(1 个)

KSSV
KSSV 2021-4-9
编辑:KSSV 2021-4-9
USe .^ instead of ^.
H = 3;
P = 100;
ls = atan(P/H);
fun = @(x) (2*(H/P)^2)*(x + (4/3)*x.^3 + (17/15)*x.^5 + (248/315)*x.^7);
q = integral(fun,0,ls);

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by