Borrar filtros
Borrar filtros

How to make syms functions have specific values

2 visualizaciones (últimos 30 días)
Yang Metin
Yang Metin el 27 de Sept. de 2021
Respondida: Star Strider el 28 de Sept. de 2021
For example, there is a function F(x) which has F(0) = 0 and F'(0) = 1. I want to calculate the value of the derivative G'(0) of G(x) = 1/F(x) (this is the example), how do I write the code?
syms F(x)
G(x)=1/F(x)
dG=diff(G)
F(0)=0??
dG(0)

Respuestas (1)

Star Strider
Star Strider el 28 de Sept. de 2021
One approach —
syms c F(x) x
dF = diff(F)
dF(x) = 
F(x) = dsolve(dF == c, F(0)==0)
F(x) = 
c = solve(diff(F)==1,c) % Determine 'c’
c = 
1
F = subs(F)
F(x) = 
x
G(x) = 1/F(x)
G(x) = 
dG = diff(G)
dG(x) = 
Evaluating ‘dG(0)’ of course results in a division-by-zero error, so it is indeterminate,
Lim_dG = limit(dG, x, 0)
Lim_dG = 
and so is the limit.
There might be other approaches to solving this, for example incorporating a constant-of-integration and the evaluating it as well. However since this was not presented as an integral with integration bounds, I use this approach.
If a better apporoach is posted, I will delete my Answer.
.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by