For Loop Using the Previous Calculated Term for Each Iteration
古いコメントを表示
Hello. I feel like this should not be too difficult but I am sturggling with it.. Im trying to find the value calculated with an equation every minute, up to 15 minutes (equations uses seconds). The first equation starting at 0 seconds using a constant value already given (denoted as 'r_NaCl') but every other iteration will use the previously calculated value in the place of the r_NaCl. This was my try but it is not working. I then need to plot it which I can do but this attemp gives me an x1 that is 1x16 and y1 that is 1x31 and im not sure why. Thank you in advance for your help!
x1=[];
y1=[];
for time=0:60:900
if time==0;
rate_NaCl=sqrt(((r_NaCl)^2)+(2*rdrdt_NaCl*time));
elseif time>0;
rate_NaCl(i)=sqrt(((rate_NaCl(i-1))^2)+(2*rdrdt_NaCl*time));
end
x1=[x1 time];
x2=[x2 time];
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!