numeric integral, symbolic function, whats wrong here?

1 vue (au cours des 30 derniers jours)
Stina Ravdna Lorås
Stina Ravdna Lorås le 19 Jan 2021
I wonder why matlab wont solve this integral for me. Is it the variable t that is the problem? I tried to use vpa in case that was the problem, but it does not look like that was the case eiter. Could someone please help me out?
clc
clear all
syms t;
rho = exp(sin(t));
theta = 2*exp(sin(t));
phi = 3*exp(sin(t));
rho_dot = diff(rho);
theta_dot = diff(theta);
phi_dot = diff(phi);
func = sqrt(rho_dot.^2+rho.^2*theta_dot.^2+ rho.^2*phi_dot.^2*(sin(theta)).^2)
vpafunc = vpa(func);
dist01 = integral(vpafunc, 0, 1)
Error messages (and cmd window) is as follows:
func =
(exp(2*sin(t))*cos(t)^2 + 4*exp(4*sin(t))*cos(t)^2 + 9*sin(2*exp(sin(t)))^2*exp(4*sin(t))*cos(t)^2)^(1/2)
Error using integral (line 82)
First input argument must be a function handle.
Error in Modreg_Ov1 (line 20)
dist01 = integral(vpafunc, 0, 1)

Réponse acceptée

Stephan
Stephan le 19 Jan 2021
Modifié(e) : Stephan le 19 Jan 2021
clc
clear
syms t;
rho = exp(sin(t));
theta = 2*exp(sin(t));
phi = 3*exp(sin(t));
rho_dot = diff(rho);
theta_dot = diff(theta);
phi_dot = diff(phi);
func = sqrt(rho_dot.^2+rho.^2*theta_dot.^2+ rho.^2*phi_dot.^2*(sin(theta)).^2)
dist01 = vpa(int(func,0,1)) % Use int for symbolic integration

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by