Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Simple for loop question.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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
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.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!