Integrating function of t over numerical values
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ragini Ravichandren
le 21 Oct 2019
Modifié(e) : Ragini Ravichandren
le 21 Oct 2019
Has anyone ever experienced the following errors when attempting to integrate a function handle with respect to a certain variable? I followed the commands used to calculate an integral, and found myself with the following problems. Any advice would be greatly appreciated!
0 commentaires
Réponse acceptée
Bjorn Gustavsson
le 21 Oct 2019
Yes, that means that the function you call integral with is called with an array of values - therefore your function (the long expression) should manage that. The way you've written it you will, implicitly, call it with arrays for t - so you'll have to replace ^ (which is the matrix-power in matlab) to .^ (which is the elementwise power), and where you have t*cos(t) (or the like) you'll also have to change from matrix-multiplication (*) to element-wise multiplication (.*).
HTH
1 commentaire
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!