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);

Réponses (1)

KSSV
KSSV le 9 Avr 2021
Modifié(e) : KSSV le 9 Avr 2021

0 votes

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);

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by