Error using sym/cat>checkDimensions (line 70) CAT arguments dimensions not consistent.

27 views (last 30 days)
Hi everyone, On running the code on the attachment/or dropbox link
https://www.dropbox.com/s/l5f3096vinkxmuc/ODE15iExample.m?dl=0
I get the error message:
Error using sym/cat>checkDimensions (line 70)
CAT arguments dimensions not consistent.
Error in sym/cat>catMany (line 35)
[resz, ranges] = checkDimensions(sz,dim);
Error in sym/cat (line 27)
ySym = catMany(dim, args);
Error in sym/vertcat (line 19)
ySym = cat(1,args{:});
Error in ODE15iExample (line 8)
eqs = [diff(c(t),t) == 1 / 1.5e-6 * (1.666667e-5 * 6.51332e-2 - 1.666667e-5 * c(t)) - ((c(t) * 8.314 * 323.15 - 149 * b(t)) / (1 /
4.14e-6) + (149 / ((1 + (1.39e-9 * d(t)) / (2.89e-9 * e(t))) * 8.4e-4)))...
What can I do?

Accepted Answer

Star Strider
Star Strider on 15 Aug 2018
I did not troubleshoot all the errors that might be in your code, only the ones in the ‘eqs’ vector. Spaces are important, and please do not use continuation ellipses when you intend a new line. Rather than manually remove the spaces, I just put every line in parentheses. Note that the continuation line in the ‘diff(v(t),t) ==’ line, there is a missing operator. I used a + creating ‘+ n(t)’, so if I guessed wrong, replace it appropriately.
Try this version of ‘eqs’:
eqs = [(diff(c(t),t) == 1 / 1.5e-6 * (1.666667e-5 * 6.51332e-2 - 1.666667e-5 * c(t)) - ((c(t) * 8.314 * 323.15 - 149 * b(t)) / (1 / 4.14e-6) + (149 / ((1 + (1.39e-9 * d(t)) / (2.89e-9 * e(t))) * 8.4e-4))) );
(diff(g(t),t) == 1/1.5e-6 * (-1.666667e-5 * g(t)) -( 9.598e-4 * ( 1 + (1.39e-9 * d(t)) /( 3.53e-9 * h(t))) * (g(t) * 8.314 * 323.15 / 5.15e3 - i(t))) );
(diff(e(t),t) == ((c(t) * 8.314 * 323.15 - 149 * b(t)) / (1 / 4.14e-6) + ( 149 / ((1 + (1.39e-9 * d(t)) / ( 2.89e-9 * e(t))) * 8.4e-4)) - (0.162 * exp(5153/323.15) * (((d(t) * k(t)) / 1.07e-7) - 1) * (10 / ((d(t) * k(t)) / 1.07e-7)))) );
(diff(h(t),t) == (9.598e-4 * ( 1 + (1.39e-9 * d(t)) / (3.53e-9 * h(t))) * (g(t) * 8.314 * 323.15 / 5.15e3 - i(t))) - (-8.825e-3 * 12.54 * 100.0869 * m(t) * n(t) * (1-(0.84*n(t)) / (1 + 0.84 * n(t)))) );
(diff(u(t),t) == (-8.825e-3 * 12.54 * 100.0869 * m(t) * n(t) * (1 - (0.84 * n(t)) /(1 + 0.84 * n(t)))) - (0.162 * exp(-5153/323.15) * (((d(t) * k(t)) / 1.07e-7) - 1 * (10 /((d(t) * k(t)) / 1.07e-7)))) );
(diff(m(t),t) == -m(t) * (-8.825e-3 * 12.54 * 100.0869 * m(t) * n(t) * ( 1 - (0.84 * n(t)) / (1 + 0.84 * n(t)))) * 100.0869 / 2703 );
(diff(v(t),t) == (-8.825e-3 * 12.54 * 100.0869 * m(t) * n(t) * (1 - (0.84 * n(t)) / (1 + 0.84 * n(t)))) * 258.30 / 2540 ...
+ n(t) + 2 * d(t) - ((e(t) * 6.24 * n(t)) / (n(t)^2 + 6.24 * n(t) + 6.24 * 5.68e-5)) - 2 * ((e(t) * 6.24 * 5.68e-5) / (n(t)^2 + 6.24 * n(t) + 6.24 * 5.68e-5)) - ((h(t) * 1.7e-3 *n(t)) / (n(t)^2 + 1.7e-3 * n(t) + 1.7e-3 * 6.55e-8)) - 2 * ((h(t) * 1.7e-3 * 6.55e-8) / (n(t)^2 + 1.7e-3 * n(t) + 1.7e-3 * 6.55e-8)) - 5.3e-8 / n(t) == 0) ;
(1.7e-3 == n(t) * r(t) / i(t) );
(6.55e-8 == n(t) * s(t) / r(t) );
(6.24 == n(t) * q(t) / b(t) );
(5.68e-5 == n(t) * k(t) / q(t) );
(5.3e-8 == n(t) * tt(t) );
(e(t) == b(t) + q(t) + k(t) );
(h(t) == i(t) + r(t) + s(t) );
(u(t) == i(t) + r(t) + s(t))];
If you want ‘eqs’ to be a row vector instead of a column vector, replace the semicolons at the end of each line with commas.
  6 Comments
Dursman Mchabe
Dursman Mchabe on 15 Aug 2018
I'll try to figure it out. Thanks a lot for all the help you provided. I truly appreciate.
Star Strider
Star Strider on 15 Aug 2018
My pleasure, as always.
I have no recent experience with DAE functions, so troubleshooting code using them requires that the errors involve something I’m familiar with.

Sign in to comment.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!