Enact variable-dependent initial conditions in ODE45

I am trying to simplify a laser oscillator code to a single set of coupled differential equations.
The call will look something like:
[z,P] = ode45(@(z,P) odefun_RamanFF2(z,P,alpha,QD,g,A),[0,zd],Pin);
Where z is the position variable, P is the power, and the rest are constants.
P is a length(z)x8 array, with the 8 columns being the forward (1,0,1,0,1,0,1,0) and backward (0,1,0,1,0,1,0,1) power evolution along z from 0 to zd.
Rather than setting Pin to be an array of numbers, I would like to be able to stipulate relations.
Specifically, setting mirrored values:
P(1,forward) = M1.*P(1,backward) and
P(end,backward) = M2.*P(end, forward)
Where M1 and M2 are reflectance values.
The only determined value from the outset is P(1,1) = InputPower.
Is there any way to do this without Matlab just giving the 0 solution?

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Asked:

on 17 Sep 2020

Community Treasure Hunt

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

Start Hunting!