How can I write y0 code in one line and still I can get this output.
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
y0= [ (1e-2)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1));
      (1e-2)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1));
      (1e-2)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1)); ]
================================================
output 
 y0 =   0.0016
           0.0079
           0.6824
           0.0017
           0.0060
           1.2281
           0.0069
           0.0075
          -1.1515
0 Commenti
Risposte (1)
  VBBV
      
      
 il 2 Mag 2023
        y0= [ (1e-2)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1));
      (1e-2)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1));
      (1e-2)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1)); ]
y0 = [1e-2*rand(6,1);repmat((-3.14)*rand(1)+(3.14)*rand(1),3,1)]
3 Commenti
  VBBV
      
      
 il 3 Mag 2023
				how is it less than 0.0031 ? take a look at the values, they are just randome values multiplied by 1e-2. if you want the first two values to higher than 0.0031, then you can use randi  instead of rand 
y0 = [ 0.0096
    0.0081
    0.0060
    0.0044
    0.0098
    0.0030
   -0.3596
   -0.0365
   -0.3486]
y0 = [1e-2*randi([0 10],6,1);[(-3.14)*rand(1)+(3.14)*rand(1)].*rand(3,1)]
Vedere anche
Categorie
				Scopri di più su Creating and Concatenating Matrices 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!

