MATLAB Answers

How Can I solve this problem?

1 ビュー (過去 30 日間)
Dunker Yair Callo Roque
Dunker Yair Callo Roque 2021 年 4 月 9 日
編集済み: 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);

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by