how to save the values of DelL(T)

2 次查看(过去 30 天)
Viswajit Talluru
Viswajit Talluru 2022-10-25
评论: VBBV 2022-10-25
Lo = 44.46
Do = 18.76
alpha = 0.0002178
for T = 36:1:180
DeltaL = Lo*alpha*(T-35)
DelL(T) = DeltaL
end
I need the T value going from 36 through 180 and store the values in array

回答(2 个)

Chunru
Chunru 2022-10-25
Lo = 44.46;
Do = 18.76;
alpha = 0.0002178 ;
T = 36:1:180;
DelL = Lo*alpha*(T-35);
whos
Name Size Bytes Class Attributes DelL 1x145 1160 double Do 1x1 8 double Lo 1x1 8 double T 1x145 1160 double alpha 1x1 8 double cmdout 1x33 66 char

VBBV
VBBV 2022-10-25
Lo = 44.46
Lo = 44.4600
Do = 18.76
Do = 18.7600
alpha = 0.0002178
alpha = 2.1780e-04
for T = 36:1:180
DeltaL = Lo*alpha*(T-35);
DelL(T) = DeltaL;
end
DelL(DelL == 0) = [] % use this to delete zeros in DelL matrix
DelL = 1×145
0.0097 0.0194 0.0291 0.0387 0.0484 0.0581 0.0678 0.0775 0.0872 0.0968 0.1065 0.1162 0.1259 0.1356 0.1453 0.1549 0.1646 0.1743 0.1840 0.1937 0.2034 0.2130 0.2227 0.2324 0.2421 0.2518 0.2615 0.2711 0.2808 0.2905
  2 个评论
VBBV
VBBV 2022-10-25
Matlab creates vector of zeros preceding the array formed using for loop. In your case, it is DelL array
VBBV
VBBV 2022-10-25
Alternately, you can do it much simpler way without for loop as suggested by @Chunru.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by