How to restrict the domain of dependent variable in ode45

6 vues (au cours des 30 derniers jours)
Proman
Proman le 31 Juil 2020
Commenté : Proman le 3 Août 2020
Hello every one
I have this equation of ray evolution that I want to solve in matlab using ode45
where dn2 / dx equals to n * (dn / dx) and n is a function of x as n(x). n is the refractive index in Optics and this equation shows how the ray evolves in a medium of height x and range z.
β is a constant and existing, but here is my problem: I do not have the explicit form of n(x), instead, I have a data set of n for x = (0,30). How can I solve this equation using ode45, or any other method compatible for this problem, in a way that the dependent variable x is considered between 0 to 30, because my n varibales are bound only to this interval, so that I would only substitute the n variables and rest assured that x is changing according to n. n is a 1 * 300 matrix by the way
  19 commentaires
J. Alex Lee
J. Alex Lee le 3 Août 2020
You have now flipped x's and z's so many times it's hard to know what's what. It seems Walter's question is the most pertinent.
If you have no reason to believe your solution will be bound to the range (0.1,30), then I would say simply test it a posteriori. Follow James's advice to interpolate, and see if your algorithm fails because you try to evaluate n(z) at some value outside the range.
At least for z>30, I've observed that you can probably safely extrapolate linearly.
If you know the asymptotic form of as , you could piece-wise define n(z) as an interpolant from , analytic form for , and linear from .
If β value is less than the trough-like feature in you will likely have no issues, as this will guarantee your derivative to be positive so that .
Proman
Proman le 3 Août 2020
Then I am all set! Many thanks for your help ^-^

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by