MATLAB Answers

The code contains an expression too complex for code analysis to handle

6 views (last 30 days)
OgaEngr on 3 Aug 2021
I’m working on a modified SEIR model that has a couple of states. However, each state is partitioned into many compartment. Hence, the number of terms in each differential equation becomes very large. I tried to use MATLAB ode23s to solve the differential equations and got the following warning, “The file is too complex to analyze. The code contains an expression too complex for code analysis to handle.”
One of the equations is like this.
dS1 = - S1*phi1*I1 - S1*phi2*I2 - S1*phi3*I3 - … - S1*phi144*I144 - S1*alpha1*P1 - S1*alpha2*P2 - S1*alpha3*P3 … - S1*alpha144*P144 - S1*theta1*E1 - S1*theta2*E2 - S1*theta3*E3 … - S1*theta144*E144;
That’s a total of 432 terms. The warning/error appears once the number of terms in the equation exceed 144.
Is there a limit to number of terms in a differential equation that can be solve using MATLAB? Any suggestion on how I can handle this problem?
Thanks in advance.
Bjorn Gustavsson
Bjorn Gustavsson on 4 Aug 2021
dS1 = - S1*( phi_all(:).'*I_all(:) + alpha(:).'*P_all(:) + theta_all(:).'*E_all(:) );

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!