필터 지우기
필터 지우기

Code generation failed due to unexpected object of type 'RootOf'.

조회 수: 7 (최근 30일)
Della
Della 2023년 6월 7일
답변: Walter Roberson 2023년 6월 8일
Hi everyone, I am trying to run the code below, but Matlab keeps throwing this error message at me. Does anyone know whats the issue?
syms y Dy D2y x
k=5/8;
w=100;
q=1;
p=1;
r=0.06;
e=0.5;
a=1/3;
z=0.15;
t=0.9;
s1=2;
m1=0.5;
fstar=4.9259e-16;
b=0.9273;
t1=(1+(z*fstar)/(r+t*p*s1-m1))*(2200^((1-k)*(e/(1-e))))*(((1-a)/w*q*a)^(e/(1-e)))*(e/(1-e))*(1/(p*s1+r+(1-b)*fstar-m1))^((1-e*(1-a))/((1-a)*(1-e)));
ode = y-((1+(z*fstar)/(r+t*p*(Dy*x*s1/y)-((Dy*x*m1/y)+D2y*(x^2)*(s1^2)/(2*y))))*(x^((1-k)*(e/(1-e))))*(((1-a)/w*q*a)^(e/(1-e)))*(e/(1-e))*(1/(r+(1-b)*fstar+p*(Dy*x*s1/y)-((Dy*x*m1/y)+D2y*(x^2)*(s1^2)/(2*y))))^((1-e*(1-a))/((1-a)*(1-e))));
D2ynum = solve(ode==0,D2y);
D2ynum = D2ynum(3);
f = matlabFunction(D2ynum,"Vars",{x, [y Dy]});

채택된 답변

Walter Roberson
Walter Roberson 2023년 6월 8일
D2ynum = solve(ode==0, D2y, 'maxdegree', 3);

추가 답변 (1개)

Ronit
Ronit 2023년 6월 8일
If they are on your license, you can install additional toolboxes using the Add-Ons Explorer.
You can install Symbolic Math Toolbox.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by