Borrar filtros
Borrar filtros

简单的一维自适应控制​算法,目的是画出信号​x的图像,但是dso​lve一直报错!

2 visualizaciones (últimos 30 días)
Zhou guoLi
Zhou guoLi el 2 de Dic. de 2022
Respondida: Dheeraj el 20 de Sept. de 2023
x1.m文件:
function x1=x1(theta,phi,g,u)
x1=theta'*phi+g*u;
end
代码如下:
>> syms x(t) thetah(t) u e
yd=sin(t);
phi=cos(x);
gamma=6;
theta=1;
g=2;
e=x-yd;
c=2;
yd1=diff(yd);
eq1=diff(thetah)==gamma*phi*e;
cond=(thetah(0)==0);
thetah=dsolve(eq1,cond);
u=(-c*e-thetah*phi+yd1)/g;
eq2=diff(x)==x1(theta,phi,g,u);
cond=x(0)==0;
x=dsolve(eq2,cond);
plot(t,x)

Respuestas (1)

Dheeraj
Dheeraj el 20 de Sept. de 2023
Hi,
I understand you’re encountering an error using “dsolve” to solve your equations generated.
It is because “dsolve” function only solves ordinary differential equations, but equation-2 of the differential equation has an unsolved integral expression on the right-hand side of it. I.e.
Hence, MATLAB throws an error to provide an ordinary differential equation as function argument. You can re write the "thetah" equation then "dsolve" will give an output of solved expression rather than an unsolved integral.
You can refer to the below MATLAB’s documentation for better understanding of “dsolve”’s capabilities.
Hope this helps!

Categorías

Más información sobre 常微分方程 en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!