BVP4c Solving two equations simultaneously












0












$begingroup$


Say for example I have an 4th order ODE



y''' = A*y''+y


on the boundary [0 1] with the BC



y(0) = 1; y'(0) = 0; y(1) = 2; y'(1) = 0


I have my code setup like this.



init = bvpinit(linspace(0,1,10),[0,0,0,0]);
sol = bvp4c(@rhs_bvp, @bc_bvp, init);
x1 = linspace(0,1,100);
BS = deval(sol, x1);

function [ rhs ] = rhs_bvp( x, y )
A = 10;
rhs = [y(2);
y(3);
y(4);
A*y(3)+y(1)];
end

function [ bc ] = bc_bvp( yl, yr)
bc = [yl(1) - hi;
yl(2);
yr(1) - ho;
yr(2)];
end


Now Say I want to add another equation to solve simultaneously



V' = y


on the same boundary with BC



V(0) = 0; V(1) = 1


How would I go about including this new equation into this solver?










share|cite|improve this question









$endgroup$












  • $begingroup$
    You can simply add a fifth variable y(5) which takes the role of V. From the ODE you obtain one additional entry in the vector rhs and from the boundary conditions you obtain two additional entries in the vector bc.
    $endgroup$
    – Christoph
    Jan 24 at 5:21








  • 2




    $begingroup$
    Is the equation supposed to be $y'''' = Ay'' + y$?
    $endgroup$
    – Dylan
    Jan 24 at 7:03










  • $begingroup$
    No, that is not possible. The number of boundary conditions has always to be equal to the dimension of the state. If you make the parameter $A$ variable, it adds a state dimension, so that you could have these 6 BC.
    $endgroup$
    – LutzL
    Jan 24 at 7:59


















0












$begingroup$


Say for example I have an 4th order ODE



y''' = A*y''+y


on the boundary [0 1] with the BC



y(0) = 1; y'(0) = 0; y(1) = 2; y'(1) = 0


I have my code setup like this.



init = bvpinit(linspace(0,1,10),[0,0,0,0]);
sol = bvp4c(@rhs_bvp, @bc_bvp, init);
x1 = linspace(0,1,100);
BS = deval(sol, x1);

function [ rhs ] = rhs_bvp( x, y )
A = 10;
rhs = [y(2);
y(3);
y(4);
A*y(3)+y(1)];
end

function [ bc ] = bc_bvp( yl, yr)
bc = [yl(1) - hi;
yl(2);
yr(1) - ho;
yr(2)];
end


Now Say I want to add another equation to solve simultaneously



V' = y


on the same boundary with BC



V(0) = 0; V(1) = 1


How would I go about including this new equation into this solver?










share|cite|improve this question









$endgroup$












  • $begingroup$
    You can simply add a fifth variable y(5) which takes the role of V. From the ODE you obtain one additional entry in the vector rhs and from the boundary conditions you obtain two additional entries in the vector bc.
    $endgroup$
    – Christoph
    Jan 24 at 5:21








  • 2




    $begingroup$
    Is the equation supposed to be $y'''' = Ay'' + y$?
    $endgroup$
    – Dylan
    Jan 24 at 7:03










  • $begingroup$
    No, that is not possible. The number of boundary conditions has always to be equal to the dimension of the state. If you make the parameter $A$ variable, it adds a state dimension, so that you could have these 6 BC.
    $endgroup$
    – LutzL
    Jan 24 at 7:59
















0












0








0





$begingroup$


Say for example I have an 4th order ODE



y''' = A*y''+y


on the boundary [0 1] with the BC



y(0) = 1; y'(0) = 0; y(1) = 2; y'(1) = 0


I have my code setup like this.



init = bvpinit(linspace(0,1,10),[0,0,0,0]);
sol = bvp4c(@rhs_bvp, @bc_bvp, init);
x1 = linspace(0,1,100);
BS = deval(sol, x1);

function [ rhs ] = rhs_bvp( x, y )
A = 10;
rhs = [y(2);
y(3);
y(4);
A*y(3)+y(1)];
end

function [ bc ] = bc_bvp( yl, yr)
bc = [yl(1) - hi;
yl(2);
yr(1) - ho;
yr(2)];
end


Now Say I want to add another equation to solve simultaneously



V' = y


on the same boundary with BC



V(0) = 0; V(1) = 1


How would I go about including this new equation into this solver?










share|cite|improve this question









$endgroup$




Say for example I have an 4th order ODE



y''' = A*y''+y


on the boundary [0 1] with the BC



y(0) = 1; y'(0) = 0; y(1) = 2; y'(1) = 0


I have my code setup like this.



init = bvpinit(linspace(0,1,10),[0,0,0,0]);
sol = bvp4c(@rhs_bvp, @bc_bvp, init);
x1 = linspace(0,1,100);
BS = deval(sol, x1);

function [ rhs ] = rhs_bvp( x, y )
A = 10;
rhs = [y(2);
y(3);
y(4);
A*y(3)+y(1)];
end

function [ bc ] = bc_bvp( yl, yr)
bc = [yl(1) - hi;
yl(2);
yr(1) - ho;
yr(2)];
end


Now Say I want to add another equation to solve simultaneously



V' = y


on the same boundary with BC



V(0) = 0; V(1) = 1


How would I go about including this new equation into this solver?







ordinary-differential-equations numerical-methods matlab boundary-value-problem






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Jan 24 at 1:07









tenicholstenichols

83




83












  • $begingroup$
    You can simply add a fifth variable y(5) which takes the role of V. From the ODE you obtain one additional entry in the vector rhs and from the boundary conditions you obtain two additional entries in the vector bc.
    $endgroup$
    – Christoph
    Jan 24 at 5:21








  • 2




    $begingroup$
    Is the equation supposed to be $y'''' = Ay'' + y$?
    $endgroup$
    – Dylan
    Jan 24 at 7:03










  • $begingroup$
    No, that is not possible. The number of boundary conditions has always to be equal to the dimension of the state. If you make the parameter $A$ variable, it adds a state dimension, so that you could have these 6 BC.
    $endgroup$
    – LutzL
    Jan 24 at 7:59




















  • $begingroup$
    You can simply add a fifth variable y(5) which takes the role of V. From the ODE you obtain one additional entry in the vector rhs and from the boundary conditions you obtain two additional entries in the vector bc.
    $endgroup$
    – Christoph
    Jan 24 at 5:21








  • 2




    $begingroup$
    Is the equation supposed to be $y'''' = Ay'' + y$?
    $endgroup$
    – Dylan
    Jan 24 at 7:03










  • $begingroup$
    No, that is not possible. The number of boundary conditions has always to be equal to the dimension of the state. If you make the parameter $A$ variable, it adds a state dimension, so that you could have these 6 BC.
    $endgroup$
    – LutzL
    Jan 24 at 7:59


















$begingroup$
You can simply add a fifth variable y(5) which takes the role of V. From the ODE you obtain one additional entry in the vector rhs and from the boundary conditions you obtain two additional entries in the vector bc.
$endgroup$
– Christoph
Jan 24 at 5:21






$begingroup$
You can simply add a fifth variable y(5) which takes the role of V. From the ODE you obtain one additional entry in the vector rhs and from the boundary conditions you obtain two additional entries in the vector bc.
$endgroup$
– Christoph
Jan 24 at 5:21






2




2




$begingroup$
Is the equation supposed to be $y'''' = Ay'' + y$?
$endgroup$
– Dylan
Jan 24 at 7:03




$begingroup$
Is the equation supposed to be $y'''' = Ay'' + y$?
$endgroup$
– Dylan
Jan 24 at 7:03












$begingroup$
No, that is not possible. The number of boundary conditions has always to be equal to the dimension of the state. If you make the parameter $A$ variable, it adds a state dimension, so that you could have these 6 BC.
$endgroup$
– LutzL
Jan 24 at 7:59






$begingroup$
No, that is not possible. The number of boundary conditions has always to be equal to the dimension of the state. If you make the parameter $A$ variable, it adds a state dimension, so that you could have these 6 BC.
$endgroup$
– LutzL
Jan 24 at 7:59












0






active

oldest

votes











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3085299%2fbvp4c-solving-two-equations-simultaneously%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3085299%2fbvp4c-solving-two-equations-simultaneously%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith