How to create a new function file using functions and variables available in base workspace?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have created one MATLAB code which gives me N1 , N2 and N3 (saved in base workspace) all as a very big nasty functions of variable r. Now I have to solve a second order ODE by using ode45 for which I need to define a function that contains RHS of the ODE. But the RHS of my ODE conatins N1,N2,N3,r and some other variables from base workspace. So, I am not able to define this new function for RHS of ODE because that new function is not capturing the variables from base workspace. What should I do?
0 comentarios
Respuestas (2)
Steven Lord
el 24 de Ag. de 2020
If the functions are "big nasty functions" I'm guessing they're symbolic expressions. If so use dsolve to solve symbolically or use odeFunction (both those functions are listed on this documentation page) to convert it into a form the numeric ODE solvers like ode45 can handle.
Ver también
Categorías
Más información sobre Ordinary Differential Equations 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!