Outputting numbers into a single array when using a double for loop?
    7 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Rachel Frings
 il 24 Feb 2015
  
    
    
    
    
    Modificato: James Tursa
      
      
 il 24 Feb 2015
            Here is my current code:
x(1)=0;
y(1)=0;
s=100;
for n=1:s
    for t=1:s
        x(t+1)=[x(t)+randi([-1,1])];
        y(t+1)=y(t)+randi([-1,1]);
    end
T=max(x)
end
My issue is that when I calculate the maximum value it outputs one number at a time. Is there anyway I could store all of the T (maximum values) that get outputted into a single array? I want to be able to plot it against time to see how the maximum distance changes.
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

