i need to make integrat for this equation from 0 to x ,, with respect to x ,,i make several program but i cant reach to my object
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Respuesta aceptada
Stephan
el 14 de Ag. de 2018
Hi,
syms g(x) a m E
g(x) = (sqrt(2*m*(E-(a.*x))))
G(x) = int(g(x),x)
pretty(G(x))
gives the indefinite integral, which is:
G(x) =
-(2*2^(1/2)*(m*(E - a*x))^(1/2)*(E - a*x))/(3*a)
or by using pretty:
2 sqrt(2) sqrt(m (E - a x)) (E - a x)
- -------------------------------------
3 a
Best regards
Stephan
6 comentarios
Stephan
el 14 de Ag. de 2018
Editada: Stephan
el 14 de Ag. de 2018
fun_x1 = G(x);
fun_x0 = G(0);
result = simplify(fun_x1 - fun_x0);
pretty(result)
gives:
2 sqrt(2) E sqrt(E m) 2 sqrt(2) sqrt(m (E - a x)) (E - a x)
--------------------- - -------------------------------------
3 a 3 a
which is the analytical solution of your integral in the bounds from 0...x. To calculate values for this use:
fun = matlabFunction(result)
which is:
fun =
function_handle with value:
@(E,a,m,x)(sqrt(2.0).*E.*sqrt(E.*m).*(2.0./3.0))./a-(sqrt(2.0).*sqrt(m.*(E-a.*x)).*(E-a.*x).*(2.0./3.0))./a
This function handle you can call like shown in this example:
m = 10;
E = 2;
a = 0.3;
x = 5
numeric_result = fun(E,a,m,x)
and ist value is:
numeric_result =
24.5955
Más respuestas (0)
Ver también
Categorías
Más información sobre Calculus en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!