Simple for loop question.
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 7 Dez. 2012
Differential equations? So dadb means "the derivative of a with respect to b" ? But the value you give is in terms of a third variable, x ??
Jake
am 9 Dez. 2012
Bearbeitet: Walter Roberson
am 9 Dez. 2012
Jan
am 9 Dez. 2012
Are you sure that you mean a FOR-loop? Look at "doc for" and "help for", if this really matches your needs.
Antworten (1)
Rick Rosson
am 9 Dez. 2012
Bearbeitet: Rick Rosson
am 9 Dez. 2012
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.
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!