how to generate the no. in increasing order but with decreasing difference between the no.?
    2 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    SAHIL SAHOO
 il 1 Set 2022
  
    
    
    
    
    Commentato: Mathieu NOE
      
 il 1 Set 2022
            eg:- i want to generate the no. from 10 to 40 but i want the no. will generate like 
10 20 28 34 40.
in this the no. is generate from 10 to 40 and the difference is decreasing by 2.
2 Commenti
Risposta accettata
  Mathieu NOE
      
 il 1 Set 2022
        hello 
maybe this : 
(result  : a = 10    20    28    34    38    40)
% init
a(1) = 10;
delta = 10;
iter = 5;
% main loop
for ci = 1:iter
    a(ci+1) =a(ci) + delta;
    delta = delta -2;
end
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!


