MATLAB纠错.关于解复杂方程使用solve
来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/08/30 05:30:28
MATLAB纠错.关于解复杂方程使用solve
A=solve(h1*A/sqrt(alpha0^2*(1+delta*A^2*(1-A^2)+epsilon*(A^4))^2/(v1^2)-A^2)+h2*A/sqrt(1-A^2)==x(m));
其中alpha0,delta,epsilon,v1为固定已知函数,
for m=1:20
x(m)=(m-1)*0.10;
但是运行的时候报错为
Error using sym/solve (line 22)
Error using maplemex
Error,(in MTM:-solve) Vector(20,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],datatype =
integer[1]) is not valid equation or expression
Error in Manual_time_with_angle (line 42)
solve(h1*A/sqrt(alpha0^2*(1+delta*A^2*(1-A^2)+epsilon*(A^4))^2/(v1^2)-A^2)+h2*A/sqrt(1-A^2)==x(m),A);
A=solve(h1*A/sqrt(alpha0^2*(1+delta*A^2*(1-A^2)+epsilon*(A^4))^2/(v1^2)-A^2)+h2*A/sqrt(1-A^2)==x(m));
其中alpha0,delta,epsilon,v1为固定已知函数,
for m=1:20
x(m)=(m-1)*0.10;
但是运行的时候报错为
Error using sym/solve (line 22)
Error using maplemex
Error,(in MTM:-solve) Vector(20,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],datatype =
integer[1]) is not valid equation or expression
Error in Manual_time_with_angle (line 42)
solve(h1*A/sqrt(alpha0^2*(1+delta*A^2*(1-A^2)+epsilon*(A^4))^2/(v1^2)-A^2)+h2*A/sqrt(1-A^2)==x(m),A);
solve里是不用等号的,比如x=solve(f(x)),意思就是解f(x)=0时x的值.
solve()里面是表达式,不是等式.
再问: 将==改成-,他报错如下
Error using solve (line 23)
Error using maplemex
Error, incorrect syntax in parse: `-` unexpected (near 32nd character of parsed string)
再答: 这个是你本身表达式的问题,应该是矩阵大小不一致造成的,或者没有定义符号变量,你把源代码贴上来看看。我给你举个solve的例子:
>> syms x
>> x=solve(x^2-2)
x =
2^(1/2)
-2^(1/2)
solve()里面是表达式,不是等式.
再问: 将==改成-,他报错如下
Error using solve (line 23)
Error using maplemex
Error, incorrect syntax in parse: `-` unexpected (near 32nd character of parsed string)
再答: 这个是你本身表达式的问题,应该是矩阵大小不一致造成的,或者没有定义符号变量,你把源代码贴上来看看。我给你举个solve的例子:
>> syms x
>> x=solve(x^2-2)
x =
2^(1/2)
-2^(1/2)