Trying to take a generated set of values in a matrix and add to it.
1 回表示 (過去 30 日間)
古いコメントを表示
I'm trying to take the values I generate and use them for the next iteration of calculations and add a new column with the results for each iteration. The idea is Resistance. Note since the resistances are the same, the parallel resistance might look weird.
Another problem is that I only get zeros. How can I get those small values to show?
clear all
% CONSTANTS
mu = 18.27E-6; % Viscosity
x = 8*mu/pi; % Constants
D = 0.0018; % Branch Diameter in meters
NumPerGen = 1; % Starting at Generation 1
R = D/2; % Branch Radius in m
L = 3*D; % Branch Length in m 3:1 Length/Diameter ratio
for i = 1:24
Res = x*L/R^4;
ParaRes = Res/NumPerGen;
if i == 1
A(:,i) = [i,Res,ParaRes,NumPerGen,D,L];
else
A(:,i) = [i,Res + A(2,i-1),ParaRes,NumPerGen,D,L];
end
D = 0.79*D; % 21% Reduction in diameter
NumPerGen = 2*NumPerGen; % Doubles with each generation
end
0 件のコメント
採用された回答
Star Strider
2018 年 1 月 30 日
Your code runs without error, and while some values of ‘A’ are small, none appear to be zero. (Use format short E rather than format short to see the element values. See the documentation on the format (link) function for details.)
What is it doing that you don’t want it to do, or what is it not doing that you do want it to do?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!