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

조회 수: 2 (최근 30일)
Mehrdad Tavassoli
Mehrdad Tavassoli 2017년 12월 17일
답변: Star Strider 2017년 12월 17일
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

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by