フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Simple for loop question.

1 回表示 (過去 30 日間)
Jake
Jake 2012 年 12 月 7 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I am wanting to write a for loop for 2 differential equations.
For 0<x<5 dadb = (2*x)
For 5<x<10 dadb = (3*x)
How would I code this?
Cheers
  3 件のコメント
Jake
Jake 2012 年 12 月 9 日
編集済み: Walter Roberson 2012 年 12 月 9 日
Sorry i will re-write that...
For 0<x<5 dz/dx = (2*x)
For 5<x<10 dz/dx = (3*x)
Jan
Jan 2012 年 12 月 9 日
Are you sure that you mean a FOR-loop? Look at "doc for" and "help for", if this really matches your needs.

回答 (1 件)

Rick Rosson
Rick Rosson 2012 年 12 月 9 日
編集済み: Rick Rosson 2012 年 12 月 9 日
dx = 0.01;
x = (0:dx:10-dx)';
idx = (x < 5);
C = ...
D = ...
z = ( C + x.^2 / 2 ) .* idx + ( D + x.^3 / 3 ) .* ( 1 - idx ) ;
You will need to specify values for the constant C and D based on the initial value of z and the continuity condition at x = 5.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by