numeric integral, symbolic function, whats wrong here?

1 Ansicht (letzte 30 Tage)
Stina Ravdna Lorås
Stina Ravdna Lorås am 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)

Akzeptierte Antwort

Stephan
Stephan am 19 Jan. 2021
Bearbeitet: Stephan am 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

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by