Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

how can i use for loop for the given situation

1 visualizzazione (ultimi 30 giorni)
sneha kriplani
sneha kriplani il 26 Giu 2015
Chiuso: MATLAB Answer Bot il 20 Ago 2021
X=randi([1,5],3,1);
Y=randi([1,5],3,1);
for i=1:3;
Xnew(i)=[X(i,1)+.6];Xn=Xnew';
Ynew(i)=[Y(i,1)+.4];Yn=Ynew';
end
plot(Xn,Yn,'kd');
grid on;hold on;
D2X=randi([1,5],3,1);
D2Y=randi([1,5],3,1);
plot(D2X,D2Y,'ro');hold off;
axis([1,50,1,50]);
my problem is like on the first day source is generating three particles then these three particles move with the groundwater velocity, on the second day three particles again are generated by the source, on the third day again three particles by source and former particles will be moving with the groundwater velocity, source generates particles in a definite range only lets say (0-5). this will continue till 365 days.
  1 Commento
Adam
Adam il 26 Giu 2015
Please format your code to be more readable.
Also your description seems to bear no relation to your code. You talk about concepts of days, sources, particles, velocities, etc yet your code just has X, Y, D2X, etc variables. You can't assume we instantly know everything about your problem domain.
Try to keep the question terminology and the code terminology matched up (i.e. use meaningful variable names). It is far better for yourself and anyone else who needs to understand your code as well as for people expected to answer your question!

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by