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!