Looping through arrays with equation out

1 回表示 (過去 30 日間)
Young Lee
Young Lee 2019 年 9 月 23 日
回答済み: darova 2019 年 9 月 23 日
Hi, I am trying to work on some large data 17200x2 ( need to construct temperature table before doing LSR )
with initial value To (temperature) = 1
a is constant
mV = milli volt
mVo = previous mV
let A= [ 0 1; 1 2; 2 3 ; 3 4; 4 5] % is timestep in second 0:0.001:17.2
and I need the following interations for n rows(17200)
my general function is (V-Vo/a) + To = T
so iter 1 , = To = 1
iter 2 , (2-1)/a + To = T1
iter 3 , ( 3-2)/a + T1 = T2
this should be recorded in column as looping
Here is what I have tried
mV = [A(:,1),A(:,4)]; % this is 17200x2 matrix
c = mV(:,2); % didnt quite work, so decided to extract single column 17200x1 to see if working for looping
for i = 1:length(c)
mt(i) = (c(i)-c(i-1))./(0.00005)+ mt % mt(temperature) needs to be recorded , for 17200 rows
end
THank you for any advise

回答 (1 件)

darova
darova 2019 年 9 月 23 日
I have a few suggections
112Untitled.png
  1. Index is forgotten
  2. When i=1 what value be in c(i-1)
  3. Assign first value for temperature before for loop
please use special button for code inserting
111Untitled.png

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by