I am trying to solve a 1d heat equation with a constant flux boundary condition on the right-hand side and a zero flux boundary condition on the left-hand side. I've gained a lot of insight from previous answers. Answer1, Answer2. My problem setting is quite similar to Answer1. However, I am stuck with implementing the constant (not zero) flux boundary condition on the right boundary. If you can provide some MATLAB code it would be really helpful. Thanks for your effort in advance.