フィルターのクリア

Vector input for ODE45

4 ビュー (過去 30 日間)
Oday Shahadh
Oday Shahadh 2017 年 2 月 22 日
コメント済み: Walter Roberson 2017 年 2 月 23 日
Sirs, I have something like the below formula:
T=(A+B+C)+(D*T) dt where A, B and C are vectors with let me say (1,6000) length How Can I integrate this formula using ODE45, please help, and thanks in advance

採用された回答

Walter Roberson
Walter Roberson 2017 年 2 月 22 日
x0 = ... something same length as A;
[T, X] = ode45( @(t, x) f(t, X, A, B, C, D), tspan, x0);
function dy = f(t, y, A, B, C, D)
dy = (A + B + C) + (D*t);
... except of course if that were really your formula you would construct
x0 = ... something same length as A;
ApBpC = A + B + C;
[T, X] = ode45( @(t, x) f(t, X, ApBpC, D), tspan, x0);
function dy = f(t, y, ApBpC, D)
dy = ApBpC + (D*t);
  11 件のコメント
Oday Shahadh
Oday Shahadh 2017 年 2 月 23 日
how to develope the loop? to avoid overwriting a previues values?
Walter Roberson
Walter Roberson 2017 年 2 月 23 日
i_vals = 1 : 10 : t;
num_i = length(i_vals);
Tdot = zeros(num_i, 1);
for i_idx = 1 : num_i
i = i_vals(i_idx);
Tdot(i_idx) = A(i) + B(i) + C(i) - T;
end
result = TDot;
Note that the resulting value changes length as t increases. If t represents the time parameter to the ode, then this would mean that you are trying to return a different number of derivatives as time goes on.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by