0

I have a boundary value problem (specified in the picture below) that is supposed to be solved with shooting method. Note that I am working with MATLAB when doing this question. I'm pretty sure that I have rewritten the differential equation from a 2nd order differential equation to a system of 1st order differential equations and also approximated the missed value for the derivative of this differential equation when x=0 using the secant method correctly, but you could verify this so you'll be sure.

enter image description here

I have done solving this BVP with shooting method and my codes currently for this problem is as follows:

clear, clf;
global I;
I = 0.1; %Strength of the electricity on the wire
L = 0.400; %The length of the wire
xStart = 0; %Start point
xSlut = L/2; %End point
yStart = 10; %Function value when x=0
err = 5e-10; %Error tolerance in calculations
g1 = 128; %First guess on y'(x) when x=0
g2 = 89; %Second guess on y'(x) when x=0
state = 0;
X = [];
Y = [];

[X,Y] = ode45(@calcWithSec,[xStart xSlut],[yStart g1]');
F1 = Y(end,2);
iter = 0;
h = 1;
currentY = Y;

while abs(h)>err && iter<100
    [X,Y] = ode45(@calcWithSec,[xStart xSlut],[yStart g2]');
    currentY = Y;
    F2 = Y(end,2);
    Fp = (g2-g1)/(F2-F1);
    h = -F2*Fp;
    g1 = g2;
    g2 = g2 + h;
    F1 = F2;
    iter = iter + 1;
end

if iter == 100
    disp('No convergence')
else
    plot(X,Y(:,1))
end

calcWithSec:

function fp = calcWithSec(x,y)    
    alpha = 0.01; %Constant
    beta = 10^13; %Constant
    global I;

    fp = [y(2) alpha*(y(1)^4)-beta*(I^2)*10^(-8)*(1+y(1)/32.5)]';
end

My problem with this program is that for different given I's in the differential equation, I get strange curves that does not make any sense in physical meaning. For instance, the only "good" graph I get is when I=0.1. The graph to such differential equations is as follows:

enter image description here

But when I set I=0.2, then I get a graph that looks like this:

enter image description here

Again, in physical meaning and according to the given assignment, this should not happen since it gets hotter you closer you get to the middle of the mentioned wire. I want be able to calculate all I between 0.1 and 20, where I is the strength of the electricity.

I have a theory that it has something to do with my guessing values and therefore, my question is about if there is possible to implement an algorithm that forces the program to adjust the guessing values so I can get a graph that is "correct" in physical meaning? Or is it impossible to achieve this? If so, then explain why.

I have struggled with this assignment many days in row now, so all help I can get with this assignment is worth gold to me now.

Thank you all in advance for helping me out of this!

8
  • For gStart = 402.26803 you get a second solution for I=0.2. However, for I=0.5 there is only the oscillating solution with values below -50. Is there a possibility that the model is not entirely correct? May 23, 2015 at 12:41
  • @LutzL, since I am using secant method to approximate the start derivative y'(0), then I need two guess values. When you say gStart=402.26803, is only one of the two guesses to give or? When it comes to the model itself, I have solved the same boundary value problem with finite differences method and there I get exactly the solutions I want to get when plotting them. But I want to achieve the same results with shooting method and as you can see, it's by some reason more difficult. May 23, 2015 at 15:14
  • If you graph the function of initial to final derivative, you will find that in the computationally accessible range there are poles for I=0.2,...,0.5 and for larger values, the function stays decidedly negative, i.e., has a maximum with negative value. This seems so far away from a solvable problem that I suspect some problem with signs or constants in the physical model. -- gStart is the solution, meant as analogue to yStart, use the points 400 and 405 around it to initialize the secant method. May 23, 2015 at 19:33
  • @LutzL, and how do you know that the function stays decidedly negative? Did you experimented through the model and draw conclusions from your experimenting? Or do you rely on some theoretical explanation for this? May 23, 2015 at 22:53
  • Yes, as I said, producing graphs for the input-output relation of the shooting function gives this insight. I do not know why there is a difference between the methods, the order of the integration method (2 vs. 4/5) should only play a quantitative role. May 24, 2015 at 6:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.