Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

how can i use for loop for the given situation

1 Ansicht (letzte 30 Tage)
sneha kriplani
sneha kriplani am 26 Jun. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 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 Kommentar
Adam
Adam am 26 Jun. 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!

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by