numeric integral, symbolic function, whats wrong here?
1 次查看(过去 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)
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!