What's wrong with this integral?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hugo
am 10 Jul. 2015
Bearbeitet: Walter Roberson
am 11 Jul. 2015
I get an error message typing this:
integral(@(z)(sin(z)*exp(1i*z)),0, 1)
Here is the error message:
Error using *
Inner matrix dimensions must agree.
Error in @(z)(sin(z)*exp(1i*z))
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);
0 Kommentare
Akzeptierte Antwort
Star Strider
am 11 Jul. 2015
You likely need to vectorise it:
integral(@(z)(sin(z).*exp(1i*z)),0, 1)
0 Kommentare
Weitere Antworten (1)
Roger Stafford
am 11 Jul. 2015
You must define your integrand function so that it will accept a vector input. In this case that means put a dot in the multiplication symbol:
integral(@(z)(sin(z).*exp(1i*z)),0, 1)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!