integration in matlab - error

3 vues (au cours des 30 derniers jours)
Rasmus
Rasmus le 4 Mar 2014
Modifié(e) : Mischa Kim le 5 Mar 2014
I have to integrate the following expression
(3*sin^4 x)/x^4 with 0 as lower limit and 3 as upper limit.
my code is the following:
fun=@(x) (3*(sin.^4)(x))/x^4
q6=integral(fun,0,2)
what do i do wrong, it keeps saying ---> Unbalanced or unexpected parenthesis or bracket.
I can't see the problem - Anyone?

Réponse acceptée

Mischa Kim
Mischa Kim le 5 Mar 2014
Modifié(e) : Mischa Kim le 5 Mar 2014
Rasmus, use
fun = @(x) 3*(sin(x).^4)./x.^4;
sin^4 x is just another way of writing (sin(x))^4.

Plus de réponses (0)

Catégories

En savoir plus sur Operating on Diagonal Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by