numeric integral, symbolic function, whats wrong here?

2 次查看(过去 30 天)
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)

采纳的回答

Stephan
Stephan 2021-1-19
编辑:Stephan 2021-1-19
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by