作业帮 > 综合 > 作业

matlab解方程老出现is not a valid expression or equation.

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/28 11:45:58
matlab解方程老出现is not a valid expression or equation.
clear;clc;clf;
syms x K R L D T Iref E a tao;
K=0.3;R=10;L=12e-3;D=0.4;Iref=5;T=1e-4;E=350;
a=E/R;tao=L/R;
x=solve('(x-a)*exp(-T/tao)+2*a*exp((-T/tao)*(1-D-K*(Iref-x)))-a-x=0','x')
出现错误
Error using ==> solve>getEqns at 182
' (x-a)*exp(-T/tao)+2*a*exp((-T/tao)*(1-D-K*(Iref-x)))-a-x=0 ' is not a valid expression or equation.
你可能用的matlab版本比较新, 尽量用符号变量, 避免用字符串:syms x
K=0.3;R=10;L=12e-3;D=0.4;Iref=5;T=1e-4;E=350;
a=E/R;tao=L/R;
x=solve((x-a)*exp(-T/tao)+2*a*exp((-T/tao)*(1-D-K*(Iref-x)))-a-x,x) % 这一行输出x
subs(x) % x的数值结果.输出为:
x = -86471113102594225/102882269851877+40*lambertw(2251799813685248/102882269851877*exp(10847469989018732/514411349259385)) ans =   4.42205395667386