Filter löschen
Filter löschen

Looping through arrays with equation out

1 Ansicht (letzte 30 Tage)
Young Lee
Young Lee am 23 Sep. 2019
Beantwortet: darova am 23 Sep. 2019
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

Antworten (1)

darova
darova am 23 Sep. 2019
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

Kategorien

Mehr zu Performance and Memory finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by