国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

matlab求解時(shí)變系統(tǒng)的Riccati矩陣微分方程

這篇具有很好參考價(jià)值的文章主要介紹了matlab求解時(shí)變系統(tǒng)的Riccati矩陣微分方程。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

對于代數(shù)Riccati方程的求解網(wǎng)上能找到很多的資源,matlab也有成熟的函數(shù),但是對于時(shí)變系統(tǒng)的Riccati矩陣微分方程,能找到的資料還比較少。

一、求解代數(shù)Riccati方程

可以在網(wǎng)上找到很多資料,如

  • https://blog.csdn.net/m0_62299908/article/details/127807014

matlab也有相應(yīng)的一系列函數(shù) lqr、icare等。
對于這些函數(shù)不同的適用范圍自己目前了解的還不夠,之后補(bǔ)上。
這些函數(shù)到底能不能用于求解時(shí)變系統(tǒng)自己還沒搞清楚。

二、如何處理時(shí)變系統(tǒng)

參見matlab官方論壇 Solving Riccati differential equation with time variable matrix
這個(gè)帖子給出的方案是ode45中有一個(gè)關(guān)于處理時(shí)變項(xiàng)的例子。
matlab求解時(shí)變系統(tǒng)的Riccati矩陣微分方程,matlab,控制,matlab

matlab求解時(shí)變系統(tǒng)的Riccati矩陣微分方程,matlab,控制,matlab

matlab的 ode45 函數(shù)官方文檔的例子中有一個(gè) ODE with Time-Dependent Terms
內(nèi)容如下

Consider the following ODE with time-dependent parameters
y ′ ( t ) + f ( t ) y ( t ) = g ( t ) . y'(t) + f(t)y(t) = g(t). y(t)+f(t)y(t)=g(t).
The initial condition is y 0 = 1 y_0 = 1 y0?=1. The function f(t) is defined by the n-by-1 vector f evaluated at times ft. The function g(t) is defined by the m-by-1 vector g evaluated at times gt.

Create the vectors f and g.

ft = linspace(0,5,25);
f = ft.^2 - ft - 3;

gt = linspace(1,6,25);
g = 3*sin(gt-0.25);

Write a function named myode that interpolates f and g to obtain the value of the time-dependent terms at the specified time. Save the function in your current folder to run the rest of the example.
The myode function accepts extra input arguments to evaluate the ODE at each time step, but ode45 only uses the first two input arguments t and y.

function dydt = myode(t,y,ft,f,gt,g)
f = interp1(ft,f,t); % Interpolate the data set (ft,f) at time t
g = interp1(gt,g,t); % Interpolate the data set (gt,g) at time t
dydt = -f.*y + g; % Evaluate ODE at time t

Solve the equation over the time interval [1 5] using ode45. Specify the function using a function handle so that ode45 uses only the first two input arguments of myode. Also, loosen the error thresholds using odeset.

tspan = [1 5];
ic = 1;
opts = odeset('RelTol',1e-2,'AbsTol',1e-4);
[t,y] = ode45(@(t,y) myode(t,y,ft,f,gt,g), tspan, ic, opts);

Plot the solution, |y|, as a function of the time points, |t|.

plot(t,y)

三、如何處理“矩陣”微分方程

在上一節(jié)中給出的方法實(shí)際上是已經(jīng)把矩陣微分方程變換成了一列,如果矩陣較大的話還是比較麻煩。
這個(gè)帖子給出了較好的解決方案 How can I solve the matrix Riccati differential equation within MATLAB?
或者還可參考
How can I solve a matrix differential equation within MATLAB?
matlab求解時(shí)變系統(tǒng)的Riccati矩陣微分方程,matlab,控制,matlab
給出的解決方案如下
The matrix Riccati differential equation:

 dX/dt = A'X + XA - XBB'X + Q

can be solved using the functions in the ODE suite.
Assume your dependent matrix “X” is “n”-by-“n”, and you have known “n”-by-“n” matrices “A”, “B”, and “Q”. The following method will solve the matrix Riccati differential equation. Save the following as a MATLAB file somewhere on the MATLAB Path.

function dXdt = mRiccati(t, X, A, B, Q)
X = reshape(X, size(A)); %Convert from "n^2"-by-1 to "n"-by-"n"
dXdt = A.'*X + X*A - X*B*B.'*X + Q; %Determine derivative
dXdt = dXdt(:); %Convert from "n"-by-"n" to "n^2"-by-1

Then, you can use the ODE45 function to solve this problem:

[T X] = ode45(@(t,X)mRiccati(t, X, A, B, Q), [0 10], X0) 

For example, using the sample data:

A = [1 1; 2 1]; 
B = [1; 1]; 
Q = [2 1; 1 1];
X0 = [1; 1; 1; 1];

You can use the following command to solve the system of differential equation

[T X] = ode45(@(t,X)mRiccati(t, X, A, B, Q), [0 10], X0) 

ODE45 returns “X” as a vector at each time step. You may use the following code to reshape each row of “X” to get the matrix and store it in a cell array:

[m n] = size(X);
XX = mat2cell(X, ones(m,1), n);
fh_reshape = @(x)reshape(x,size(A));
XX = cellfun(fh_reshape,XX,'UniformOutput',false);

The results of this can be verified by the LQR function:

[K,S,E] = lqr(A, B, Q, 1)

where “S” should have results very similar to the last elements in “X” or “XX”. The LQR function computes the steady-state value of the system. In this example, we generated the solution for up to “t = 10”, which is an adequate approximation of infinity for this problem.

For more information on ODE45 and other such solvers, refer to the function reference page for ODE45 in the MATLAB documentation.

對于該方法網(wǎng)上還有人追問,如有需要可查閱

  • https://www.mathworks.com/matlabcentral/answers/225984-how-can-i-solve-matrix-riccati-differential-equation
  • how can i solve matrix riccati differential equation?

四、關(guān)于逆向積分

在上面的兩個(gè)例子中給出的都是初始條件,但實(shí)際上Riccati方程給出的往往是終端條件,需要逆向(backward)積分。
對于簡單的情況,微分方程中并不含自變量。
此時(shí)逆向積分并不復(fù)雜,只需要在定義時(shí)間區(qū)間tspan時(shí)把初始時(shí)刻和終端時(shí)刻調(diào)換即可,參考鏈接為
https://www.mathworks.com/matlabcentral/answers/151336-solving-differential-riccati-equation-with-a-boundary-condition

示例如下

par = [1;2;1];  % q0, q1, and q2
yf = 1;
ti = 0; tf = 2;
opt = odeset('AbsTol',1.0e-07,'RelTol',1.0e-07);
[t,y] = ode45( @riccatiEquation, [tf,ti], yf ,opt, par);

% Visualize
plot(t,y)

function dydx = riccatiEquation(x,y,parameters)
q0 = parameters(1);
q1 = parameters(2);
q2 = parameters(3);

dydx = q0 + q1*y + q2*y*y;
end

或者采用平移的方式,可參考吳受章的最優(yōu)控制書。
如果實(shí)在不行,用變量代換轉(zhuǎn)換成初值問題是不是也行?沒有進(jìn)行仿真驗(yàn)證。

其實(shí)對于這類問題有一個(gè)更廣義的形式,即微分方程的多點(diǎn)邊值問題,對此該類問題不能使用ode45解決,而應(yīng)采用 BVP4CBVP5C 來解決。參考鏈接如下

  • Using ode45 to solve system of ODEs with some initial conditions and some terminal conditions
  • Solve BVP with Multiple Boundary Conditions
  • https://stackoverflow.com/questions/29162100/how-can-i-solve-a-system-of-odes-with-some-terminal-conditions-in-matlab

五、線性時(shí)變系統(tǒng)的Riccati矩陣微分方程

前段時(shí)間因事中斷了一段時(shí)間,現(xiàn)在自己已經(jīng)不面臨這個(gè)問題了…
按照前幾節(jié)的步驟似乎能解決這一問題,但沒有經(jīng)過仿真驗(yàn)證自己心里也不是很有底。

六、補(bǔ)充各類參考鏈接

時(shí)間有限,本來還想給幾個(gè)例子,看之后自己還有沒有機(jī)會吧。這里把一些自己在這個(gè)過程中的參考鏈接放上來

How can I solve riccati equation in Simulink with varying state space?

有一些鏈接給了代碼,沒來得及細(xì)看,但感覺似乎都是時(shí)不變系統(tǒng)的文章來源地址http://www.zghlxwxcb.cn/news/detail-751504.html

  • 這個(gè)代碼聲稱解決的是時(shí)變矩陣微分方程,但得到的是近似解。而且還有論文支撐,看上去最靠譜 Recursive Approximate Solution to Matrix Diff. Riccati Eq.
  • Solve Riccati Differential Equation (solve_riccati_ode)
  • symmetric differential matrix Riccati equations
  • 這份代碼和上一份是同一個(gè)人上傳到MathWorks網(wǎng)站上的,相差僅一天,可能是一樣的 The solve the matrix Riccati differential equation
  • Algebraic Riccati Equation Solver
  • 這份代碼也有論文,但似乎很專業(yè),可能是數(shù)學(xué)專業(yè)的 Invariant Galerkin Ansatz Spaces and Davison-Maki Methods for the Numerical Solution of Differential Riccati Equations

到了這里,關(guān)于matlab求解時(shí)變系統(tǒng)的Riccati矩陣微分方程的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • matlab使用教程(27)—微分代數(shù)方程(DAE)求解

    matlab使用教程(27)—微分代數(shù)方程(DAE)求解

    ????????微分代數(shù)方程是一類微分方程,其中一個(gè)或多個(gè)因變量導(dǎo)數(shù)未出現(xiàn)在方程中。方程中出現(xiàn)的未包含其導(dǎo)數(shù)的變量稱為代數(shù)變量,代數(shù)變量的存在意味著您不能將這些方程記為顯式形式 y ′ = f t , y 。相反,您可以解算下列形式的 DAE: ????????? ode15s 和 ode23t

    2024年02月11日
    瀏覽(56)
  • matlab使用教程(28)—微分方程(ODE)求解常見問題

    matlab使用教程(28)—微分方程(ODE)求解常見問題

    ????????本博客說明如何將 ODE 解約束為非負(fù)解。施加非負(fù)約束不一定總是可有可無,在某些情況下,由于方程的物理解釋或解性質(zhì)的原因,可能有必要施加非負(fù)約束。僅在必要時(shí)對解施加此約束,例如不這樣做積分就會失敗或者解將不適用的情況。 ????????如果解的

    2024年02月11日
    瀏覽(18)
  • MATLAB 之 非線性方程數(shù)值求解、最優(yōu)化問題求解和常微分方程初值問題的數(shù)值求解

    MATLAB 之 非線性方程數(shù)值求解、最優(yōu)化問題求解和常微分方程初值問題的數(shù)值求解

    非線性方程的求根方法很多,常用的有牛頓迭代法,但該方法需要求原方程的導(dǎo)數(shù),而在實(shí)際運(yùn)算中這一條件有時(shí) 是不能滿足的,所以又出現(xiàn)了弦截法、二分法等其他方法。 在 MATLAB 中,非線性方程的求解和最優(yōu)化問題往往需要調(diào)用最優(yōu)化工具箱來解決。優(yōu)化工具箱提供了一

    2024年02月08日
    瀏覽(28)
  • 歐拉法與梯形法求解微分方程【含matlab源代碼】

    歐拉法與梯形法求解微分方程【含matlab源代碼】

    本文介紹兩種入門級求解微分方程的方法 —— 梯形法與歐拉法。 將上述方程組改寫成matlab語言: 一、歐拉法 1.1?向前歐拉公式 1.2?向后歐拉公式 ? ? 歐拉法求解源代碼? ? ?? 歐拉法結(jié)果圖?? 二、梯形法 ? ?梯形法求解源代碼??? ???梯形法結(jié)果圖? ? 感謝 Miracle 向公眾

    2024年02月15日
    瀏覽(21)
  • 微分方程+傳染病模型(指數(shù)傳播、SI、SIS、SIR模型)+MATLAB求解

    微分方程+傳染病模型(指數(shù)傳播、SI、SIS、SIR模型)+MATLAB求解

    本文為北海的數(shù)模課程學(xué)習(xí)筆記,課程出自微信公眾號:數(shù)學(xué)建模BOOM。 求贊!求收藏!求關(guān)注! 微分方程結(jié)合傳染病模型(如指數(shù)傳播、SI、SIS、SIR模型)提供了一種用數(shù)學(xué)公式描述疾病傳播動態(tài)的方法,有助于理解和預(yù)測疾病在人群中的傳播路徑和速度。 目錄 指數(shù)傳播模

    2024年02月04日
    瀏覽(28)
  • PINN深度學(xué)習(xí)求解微分方程系列一:求解框架

    PINN深度學(xué)習(xí)求解微分方程系列一:求解框架

    下面我將介紹內(nèi)嵌物理知識神經(jīng)網(wǎng)絡(luò)(PINN)求解微分方程。首先介紹PINN基本方法,并基于Pytorch框架實(shí)現(xiàn)求解一維Poisson方程。 內(nèi)嵌物理知識神經(jīng)網(wǎng)絡(luò)(PINN)入門及相關(guān)論文 深度學(xué)習(xí)求解微分方程系列一:PINN求解框架(Poisson 1d) 深度學(xué)習(xí)求解微分方程系列二:PINN求解burg

    2023年04月16日
    瀏覽(22)
  • Fortran 微分方程求解 --ODEPACK

    Fortran 微分方程求解 --ODEPACK

    最近涉及到使用Fortran對微分方程求解,我們知道MATLAB已有內(nèi)置的函數(shù),比如ode家族,ode15s,對應(yīng)著不同的求解辦法。通過查看odepack的官方文檔,我嘗試使用了dlsode求解剛性和非剛性常微分方程組。 首先是github網(wǎng)址:https://github.com/jacobwilliams/odepack 具體使用辦法: 1.我使用的

    2024年02月11日
    瀏覽(18)
  • Simulink基礎(chǔ)【1】-彈簧-阻尼模型的常微分方程求解

    Simulink是Matlab軟件的框圖設(shè)計(jì)環(huán)境,可用于各種動態(tài)系統(tǒng)的建模、分析與仿真過程。如:導(dǎo)航制導(dǎo)、通訊、電子、機(jī)械、熱力學(xué)等諸多領(lǐng)域。這些系統(tǒng)在數(shù)學(xué)角度描述上涉及連續(xù)、離散、非線性、時(shí)變等用解析方法難以求解的系統(tǒng),因而采用Simulink進(jìn)行建模與仿真是指導(dǎo)這些系

    2023年04月08日
    瀏覽(33)
  • Python和Julia TensorFlow科學(xué)計(jì)算常微分方程求解器

    常微分方程(ODE)可用于描述動態(tài)系統(tǒng)。 從某種程度上來說,我們生活在一個(gè)動態(tài)系統(tǒng)中,窗外的天氣從黎明到黃昏都在變化,我們體內(nèi)發(fā)生的新陳代謝也是一個(gè)動態(tài)系統(tǒng),因?yàn)殡S著時(shí)間的推移,成千上萬的反應(yīng)和分子被合成和降解。 更正式地說,如果我們定義一組變量,

    2024年02月01日
    瀏覽(43)
  • matlab解微分方程

    matlab解微分方程

    f=@(變量) 表達(dá)式; x1為2 3 4 5;x2為3 4 5 6的情況下求解函數(shù)f的值 用“dsolve” step1: 申明自變量和因變量 syms y(x) step2:編程 得到: step1: 申明自變量和因變量 syms y(x) step2:編程 得到 step1.寫函數(shù)文件 step2.主函數(shù) 相當(dāng)于定義了一個(gè)新向量y,然后列 匿名函數(shù) ,方程的 左邊都是一階

    2024年02月13日
    瀏覽(27)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包