英语翻译What you are doing makes no sense: you define some value
英语翻译
What you are doing makes no sense: you define some values as symbolic, and then
try to use them in a numeric solver ode45. You need to decide what you are doing:
are you working with symbolic mathematics or numeric mathematics?
Who told you to use syms? Why do you think these declarations are necessary?
And why do you have plot(t,x) and legend('x(1)','x(2)','x(3)','x(4)','x(5)','x
(6)') before your ode45 call even works?
You need to learn to write code carefully, checking each line that it works and
gives the expected result before moving onto the next. Writing a large amount of
untested code all at once, finding that it does not work and then trying to find
the bugs is not a good way to program. Learn to test your code as you write it. If
you had done this you would have avoided all of the errors in this code.
If you get rid of the syms declarations and defined the values before that
calculation, then the numeric function solving might work, although t is not
currently used anywhere inside the function: