help me to fix this problem

In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in cuba (line 90)
y_7(i+1) = y_7(i)+16*l_1/135+6656*l_3/12825+28561*l_4/56430-9*l_5/50+2*l_6/55;

Answers (1)

Use the debugger, see e.g. https://www.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html. You can type this in the command window:
dbstop if error
Then run the code again. When Matlab stops at the error, check the dimensions of the variables, either in the Workspace-Browser, or in the command window:
size(y_7(i)+16*l_1/135+6656*l_3/12825+28561*l_4/56430-9*l_5/50+2*l_6/55)
size(y_7)
size(l_1)
size(l_3)
size(l_4)
size(l_5)
size(l_6)
The error message means, that the expression on the right side is not a scalar, but the one on the left side is.

This question is closed.

Tags

Asked:

on 15 Jul 2018

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!