필터 지우기
필터 지우기

How to restrict the domain of dependent variable in ode45

조회 수: 2 (최근 30일)
Proman
Proman 2020년 7월 31일
댓글: Proman 2020년 8월 3일
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
J. Alex Lee
J. Alex Lee 2020년 8월 3일
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 2020년 8월 3일
Then I am all set! Many thanks for your help ^-^

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by