Solve issue with Matlab 2018b version Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Solve linear system with matlabEvaluating differential entropies with Matlab: NaN issueSolving 2nd order ODE with 2 independent parameters(over finite intervals), with bounds on solutionMATLAB solve a single equationRunge-Kutta Method solving four ODESIssue using Matlab RK2 CodeIntegration with parameters in MatlabSyntax issue with opti-toolboxFormulating a linear difference equation model and some MatLab tipsSolve advection equation $v_t + v_x = 1$ numerically with Matlab
What would be the ideal power source for a cybernetic eye?
List of Python versions
Why aren't air breathing engines used as small first stages
How to deal with a team lead who never gives me credit?
Can a non-EU citizen traveling with me come with me through the EU passport line?
Should I discuss the type of campaign with my players?
How much time will it take to get my passport back if I am applying for multiple Schengen visa countries?
What does this icon in iOS Stardew Valley mean?
English words in a non-english sci-fi novel
What's the purpose of writing one's academic biography in the third person?
Fundamental Solution of the Pell Equation
What is Arya's weapon design?
Output the ŋarâþ crîþ alphabet song without using (m)any letters
porting install scripts : can rpm replace apt?
How widely used is the term Treppenwitz? Is it something that most Germans know?
Dating a Former Employee
What exactly is a "Meth" in Altered Carbon?
Can I cast Passwall to drop an enemy into a 20-foot pit?
Gordon Ramsay Pudding Recipe
Storing hydrofluoric acid before the invention of plastics
How do I name drop voicings
When a candle burns, why does the top of wick glow if bottom of flame is hottest?
Why is "Consequences inflicted." not a sentence?
Why light coming from distant stars is not discrete?
Solve issue with Matlab 2018b version
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Solve linear system with matlabEvaluating differential entropies with Matlab: NaN issueSolving 2nd order ODE with 2 independent parameters(over finite intervals), with bounds on solutionMATLAB solve a single equationRunge-Kutta Method solving four ODESIssue using Matlab RK2 CodeIntegration with parameters in MatlabSyntax issue with opti-toolboxFormulating a linear difference equation model and some MatLab tipsSolve advection equation $v_t + v_x = 1$ numerically with Matlab
$begingroup$
I was very successfully solving an equation numerically in Matlab R2014a with the following code
syms a T
v2=-2.3750
g=1;
b=0.0001;
e2=0.5;
k=0.2;
w=-2*cos(k);
eqn = sin(3*k+a)./sin(2*k+a)==v2-w+(g.*T.^2)+(e2.*T.^2.*sin(k)^2)./(sin(2*k+a)^2+b*T.^2*sin(k).^2);
sol = solve(eqn,a,[0 pi]);
digits(5)
solutions = vpa(subs(sol),3);
xx=subs(real(solutions),T,[0:0.1:3])
Then I switched to Matlab 2018b and this code fails to give the solutions. I have to restrict a
to the range $0$ to $pi$ and $T$ is a vector T=[0:0.1:3]
. It would give 6 solutions i.e., xx
will be $6times 31$. Could someone tell me why the same working code in R2014a doesn't work in R2018b and any possible workaround? Thanks.
numerical-methods matlab
$endgroup$
|
show 2 more comments
$begingroup$
I was very successfully solving an equation numerically in Matlab R2014a with the following code
syms a T
v2=-2.3750
g=1;
b=0.0001;
e2=0.5;
k=0.2;
w=-2*cos(k);
eqn = sin(3*k+a)./sin(2*k+a)==v2-w+(g.*T.^2)+(e2.*T.^2.*sin(k)^2)./(sin(2*k+a)^2+b*T.^2*sin(k).^2);
sol = solve(eqn,a,[0 pi]);
digits(5)
solutions = vpa(subs(sol),3);
xx=subs(real(solutions),T,[0:0.1:3])
Then I switched to Matlab 2018b and this code fails to give the solutions. I have to restrict a
to the range $0$ to $pi$ and $T$ is a vector T=[0:0.1:3]
. It would give 6 solutions i.e., xx
will be $6times 31$. Could someone tell me why the same working code in R2014a doesn't work in R2018b and any possible workaround? Thanks.
numerical-methods matlab
$endgroup$
1
$begingroup$
Your code produces error messages under MATLAB 2018b. Do you have a code which works in MATLAB 2018b? Note that stackoverflow is probably a better forum for your question.
$endgroup$
– Carl Christian
Apr 1 at 16:17
$begingroup$
@CarlChristian This code used to work perfectly in R2014a, but perhaps due to some changes in the version R2018b, the solve function returns errors now. That said, it gives an output if we remove[0 pi]
from the sol. i.e., replacesol=solve(eqn,a,[0 pi])
bysol = solve(eqn,a)
. But then I don't know how to implement the constraint ona
. Secondly, the solution then looks very strange with a bunch ofangle
,root
,z
etc. It should be six solutions, i.e.,xx
should be $6times 31$ instead of $1times 31$.
$endgroup$
– AtoZ
Apr 1 at 16:28
1
$begingroup$
I am now getting the largest dump of warnings from MATLAB that I have seen in a while! In your position I would define a function $f$ of multiple variables, use this function to define a function $g$ of a single variable, i.e., $a$ and then feed this function to fzero. I have confidence in the algorithm used by fzero.
$endgroup$
– Carl Christian
Apr 1 at 16:50
1
$begingroup$
Read this and this and finally this
$endgroup$
– Carl Christian
Apr 1 at 19:20
1
$begingroup$
This isn’t a direct response, but rather a change that happened between R2014a and R2018b. It is now default for MATLAB to expand singleton dimensions in binary operations to reduce the need for bsxfun. I don’t know if that is the situation here, but it may be having an impact. There were also a significant number of changes—mostly to graphics—in R2014b, which might also be a part of the cause here.
$endgroup$
– Daryl
Apr 2 at 12:16
|
show 2 more comments
$begingroup$
I was very successfully solving an equation numerically in Matlab R2014a with the following code
syms a T
v2=-2.3750
g=1;
b=0.0001;
e2=0.5;
k=0.2;
w=-2*cos(k);
eqn = sin(3*k+a)./sin(2*k+a)==v2-w+(g.*T.^2)+(e2.*T.^2.*sin(k)^2)./(sin(2*k+a)^2+b*T.^2*sin(k).^2);
sol = solve(eqn,a,[0 pi]);
digits(5)
solutions = vpa(subs(sol),3);
xx=subs(real(solutions),T,[0:0.1:3])
Then I switched to Matlab 2018b and this code fails to give the solutions. I have to restrict a
to the range $0$ to $pi$ and $T$ is a vector T=[0:0.1:3]
. It would give 6 solutions i.e., xx
will be $6times 31$. Could someone tell me why the same working code in R2014a doesn't work in R2018b and any possible workaround? Thanks.
numerical-methods matlab
$endgroup$
I was very successfully solving an equation numerically in Matlab R2014a with the following code
syms a T
v2=-2.3750
g=1;
b=0.0001;
e2=0.5;
k=0.2;
w=-2*cos(k);
eqn = sin(3*k+a)./sin(2*k+a)==v2-w+(g.*T.^2)+(e2.*T.^2.*sin(k)^2)./(sin(2*k+a)^2+b*T.^2*sin(k).^2);
sol = solve(eqn,a,[0 pi]);
digits(5)
solutions = vpa(subs(sol),3);
xx=subs(real(solutions),T,[0:0.1:3])
Then I switched to Matlab 2018b and this code fails to give the solutions. I have to restrict a
to the range $0$ to $pi$ and $T$ is a vector T=[0:0.1:3]
. It would give 6 solutions i.e., xx
will be $6times 31$. Could someone tell me why the same working code in R2014a doesn't work in R2018b and any possible workaround? Thanks.
numerical-methods matlab
numerical-methods matlab
asked Apr 1 at 8:52
AtoZAtoZ
355
355
1
$begingroup$
Your code produces error messages under MATLAB 2018b. Do you have a code which works in MATLAB 2018b? Note that stackoverflow is probably a better forum for your question.
$endgroup$
– Carl Christian
Apr 1 at 16:17
$begingroup$
@CarlChristian This code used to work perfectly in R2014a, but perhaps due to some changes in the version R2018b, the solve function returns errors now. That said, it gives an output if we remove[0 pi]
from the sol. i.e., replacesol=solve(eqn,a,[0 pi])
bysol = solve(eqn,a)
. But then I don't know how to implement the constraint ona
. Secondly, the solution then looks very strange with a bunch ofangle
,root
,z
etc. It should be six solutions, i.e.,xx
should be $6times 31$ instead of $1times 31$.
$endgroup$
– AtoZ
Apr 1 at 16:28
1
$begingroup$
I am now getting the largest dump of warnings from MATLAB that I have seen in a while! In your position I would define a function $f$ of multiple variables, use this function to define a function $g$ of a single variable, i.e., $a$ and then feed this function to fzero. I have confidence in the algorithm used by fzero.
$endgroup$
– Carl Christian
Apr 1 at 16:50
1
$begingroup$
Read this and this and finally this
$endgroup$
– Carl Christian
Apr 1 at 19:20
1
$begingroup$
This isn’t a direct response, but rather a change that happened between R2014a and R2018b. It is now default for MATLAB to expand singleton dimensions in binary operations to reduce the need for bsxfun. I don’t know if that is the situation here, but it may be having an impact. There were also a significant number of changes—mostly to graphics—in R2014b, which might also be a part of the cause here.
$endgroup$
– Daryl
Apr 2 at 12:16
|
show 2 more comments
1
$begingroup$
Your code produces error messages under MATLAB 2018b. Do you have a code which works in MATLAB 2018b? Note that stackoverflow is probably a better forum for your question.
$endgroup$
– Carl Christian
Apr 1 at 16:17
$begingroup$
@CarlChristian This code used to work perfectly in R2014a, but perhaps due to some changes in the version R2018b, the solve function returns errors now. That said, it gives an output if we remove[0 pi]
from the sol. i.e., replacesol=solve(eqn,a,[0 pi])
bysol = solve(eqn,a)
. But then I don't know how to implement the constraint ona
. Secondly, the solution then looks very strange with a bunch ofangle
,root
,z
etc. It should be six solutions, i.e.,xx
should be $6times 31$ instead of $1times 31$.
$endgroup$
– AtoZ
Apr 1 at 16:28
1
$begingroup$
I am now getting the largest dump of warnings from MATLAB that I have seen in a while! In your position I would define a function $f$ of multiple variables, use this function to define a function $g$ of a single variable, i.e., $a$ and then feed this function to fzero. I have confidence in the algorithm used by fzero.
$endgroup$
– Carl Christian
Apr 1 at 16:50
1
$begingroup$
Read this and this and finally this
$endgroup$
– Carl Christian
Apr 1 at 19:20
1
$begingroup$
This isn’t a direct response, but rather a change that happened between R2014a and R2018b. It is now default for MATLAB to expand singleton dimensions in binary operations to reduce the need for bsxfun. I don’t know if that is the situation here, but it may be having an impact. There were also a significant number of changes—mostly to graphics—in R2014b, which might also be a part of the cause here.
$endgroup$
– Daryl
Apr 2 at 12:16
1
1
$begingroup$
Your code produces error messages under MATLAB 2018b. Do you have a code which works in MATLAB 2018b? Note that stackoverflow is probably a better forum for your question.
$endgroup$
– Carl Christian
Apr 1 at 16:17
$begingroup$
Your code produces error messages under MATLAB 2018b. Do you have a code which works in MATLAB 2018b? Note that stackoverflow is probably a better forum for your question.
$endgroup$
– Carl Christian
Apr 1 at 16:17
$begingroup$
@CarlChristian This code used to work perfectly in R2014a, but perhaps due to some changes in the version R2018b, the solve function returns errors now. That said, it gives an output if we remove
[0 pi]
from the sol. i.e., replace sol=solve(eqn,a,[0 pi])
by sol = solve(eqn,a)
. But then I don't know how to implement the constraint on a
. Secondly, the solution then looks very strange with a bunch of angle
, root
, z
etc. It should be six solutions, i.e., xx
should be $6times 31$ instead of $1times 31$.$endgroup$
– AtoZ
Apr 1 at 16:28
$begingroup$
@CarlChristian This code used to work perfectly in R2014a, but perhaps due to some changes in the version R2018b, the solve function returns errors now. That said, it gives an output if we remove
[0 pi]
from the sol. i.e., replace sol=solve(eqn,a,[0 pi])
by sol = solve(eqn,a)
. But then I don't know how to implement the constraint on a
. Secondly, the solution then looks very strange with a bunch of angle
, root
, z
etc. It should be six solutions, i.e., xx
should be $6times 31$ instead of $1times 31$.$endgroup$
– AtoZ
Apr 1 at 16:28
1
1
$begingroup$
I am now getting the largest dump of warnings from MATLAB that I have seen in a while! In your position I would define a function $f$ of multiple variables, use this function to define a function $g$ of a single variable, i.e., $a$ and then feed this function to fzero. I have confidence in the algorithm used by fzero.
$endgroup$
– Carl Christian
Apr 1 at 16:50
$begingroup$
I am now getting the largest dump of warnings from MATLAB that I have seen in a while! In your position I would define a function $f$ of multiple variables, use this function to define a function $g$ of a single variable, i.e., $a$ and then feed this function to fzero. I have confidence in the algorithm used by fzero.
$endgroup$
– Carl Christian
Apr 1 at 16:50
1
1
$begingroup$
Read this and this and finally this
$endgroup$
– Carl Christian
Apr 1 at 19:20
$begingroup$
Read this and this and finally this
$endgroup$
– Carl Christian
Apr 1 at 19:20
1
1
$begingroup$
This isn’t a direct response, but rather a change that happened between R2014a and R2018b. It is now default for MATLAB to expand singleton dimensions in binary operations to reduce the need for bsxfun. I don’t know if that is the situation here, but it may be having an impact. There were also a significant number of changes—mostly to graphics—in R2014b, which might also be a part of the cause here.
$endgroup$
– Daryl
Apr 2 at 12:16
$begingroup$
This isn’t a direct response, but rather a change that happened between R2014a and R2018b. It is now default for MATLAB to expand singleton dimensions in binary operations to reduce the need for bsxfun. I don’t know if that is the situation here, but it may be having an impact. There were also a significant number of changes—mostly to graphics—in R2014b, which might also be a part of the cause here.
$endgroup$
– Daryl
Apr 2 at 12:16
|
show 2 more comments
0
active
oldest
votes
Your Answer
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%2f3170362%2fsolve-issue-with-matlab-2018b-version%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%2f3170362%2fsolve-issue-with-matlab-2018b-version%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
1
$begingroup$
Your code produces error messages under MATLAB 2018b. Do you have a code which works in MATLAB 2018b? Note that stackoverflow is probably a better forum for your question.
$endgroup$
– Carl Christian
Apr 1 at 16:17
$begingroup$
@CarlChristian This code used to work perfectly in R2014a, but perhaps due to some changes in the version R2018b, the solve function returns errors now. That said, it gives an output if we remove
[0 pi]
from the sol. i.e., replacesol=solve(eqn,a,[0 pi])
bysol = solve(eqn,a)
. But then I don't know how to implement the constraint ona
. Secondly, the solution then looks very strange with a bunch ofangle
,root
,z
etc. It should be six solutions, i.e.,xx
should be $6times 31$ instead of $1times 31$.$endgroup$
– AtoZ
Apr 1 at 16:28
1
$begingroup$
I am now getting the largest dump of warnings from MATLAB that I have seen in a while! In your position I would define a function $f$ of multiple variables, use this function to define a function $g$ of a single variable, i.e., $a$ and then feed this function to fzero. I have confidence in the algorithm used by fzero.
$endgroup$
– Carl Christian
Apr 1 at 16:50
1
$begingroup$
Read this and this and finally this
$endgroup$
– Carl Christian
Apr 1 at 19:20
1
$begingroup$
This isn’t a direct response, but rather a change that happened between R2014a and R2018b. It is now default for MATLAB to expand singleton dimensions in binary operations to reduce the need for bsxfun. I don’t know if that is the situation here, but it may be having an impact. There were also a significant number of changes—mostly to graphics—in R2014b, which might also be a part of the cause here.
$endgroup$
– Daryl
Apr 2 at 12:16