Problem with overwriting values in vector
Show older comments
Hello,
my problem is with overwritting - i don't know how to overwrite vectors and save only some values. I'm solving ode ( this ode is written by me it is not ode45 or ode23 or other matlab already odefile) where i will have many values and in big netwroks i will have problem with memory - because of this i want to save only some values (for example every 4 value)
Code example of ode:
X(1) = 0.6;
Y(1)= 0.2;
licz = 1;
for tt = 1:0.05:10
l = 1;
X(l+1) = X(l) + ((X(l) *a)+(Y(l)*b));
Y(l+1) = Y(l) + (X(l)*c);
b=1;
if mod(licz,3) == 0
vector1(b) = X(l+1)
vector2(b) = Y(l+1)
end
licz=licz+1;
l=l+1
end
What i want is how to overwrite values in vector for example:
v = zeros(1,2)
step1 v = [1,0]
step2 v = [1,2]
step3 v=[2,3] (value 2 from step 2 is now on first place in vector and on second place is new value)
2 Comments
madhan ravi
on 9 Feb 2019
What’s your desired output from the above code ? State it explicitly.
Paulina Urban
on 9 Feb 2019
Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!