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

1 Ansicht (letzte 30 Tage)
Zhou guoLi
Zhou guoLi am 2 Dez. 2022
Kommentiert: am 30 Jun. 2025
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)

Antworten (1)

Dheeraj
Dheeraj am 20 Sep. 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!
  1 Kommentar
钰
am 30 Jun. 2025
thanks!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 数学 finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!