Problem with overwriting values in vector
Afficher commentaires plus anciens
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 commentaires
madhan ravi
le 9 Fév 2019
What’s your desired output from the above code ? State it explicitly.
Paulina Urban
le 9 Fév 2019
Réponses (0)
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!