BVP4c Solving two equations simultaneously
$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?
ordinary-differential-equations numerical-methods matlab boundary-value-problem
$endgroup$
add a comment |
$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?
ordinary-differential-equations numerical-methods matlab boundary-value-problem
$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
add a comment |
$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?
ordinary-differential-equations numerical-methods matlab boundary-value-problem
$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
ordinary-differential-equations numerical-methods matlab boundary-value-problem
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
add a comment |
$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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
$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