As i using function "solve", matlab give me an error.

2 views (last 30 days)
here is my code clear all, close all, clc;
x=sym('x',[3,1]); syms u; syms a ru R b;
% % % ************
a=10; b=100/7; ru=2*x(1)^3/7-8*x(1)/7; R=0; g=[0;1;0]; uh=0;
% % % ************
f=[a*(x(2)-x(1)-ru);x(1)-x(2)+x(3);-b*x(2)-R*x(3)]; xd=f+g*u; matlabFunction(xd,'File','CHUAcircuit');
% % % ************ % % EX.1 % 1.1 % u=sym('u',[3,1]); % eqns=[xd,u] [xh1,xh2,xh3]=solve(eqns,[x,u])
and here's the error: Error using sym.getEqnsVars>checkVariables (line 92) The second argument must be a vector of symbolic variables.
and I dont know why

Answers (1)

Star Strider
Star Strider on 17 Dec 2017
It objects to ‘u’ in the variable list.
This works:
eqns=xd
[xh1,xh2,xh3]=solve(eqns,x)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!