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

13 vues (au cours des 30 derniers jours)
Della
Della le 7 Juin 2023
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]});

Réponse acceptée

Walter Roberson
Walter Roberson le 8 Juin 2023
D2ynum = solve(ode==0, D2y, 'maxdegree', 3);

Plus de réponses (1)

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

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by