please help, I want to make comparative loop
    5 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Hi everyone, I have 2 problems.
1-I want to plot a figure for each value of y its mean i should have 10 figures, i tried many cases but i only got 1 figure.
2- i want to get max(y) for each iteration. then max y for all iteration and i want to know the max y belong to which step.
M = eye(2,2);
C = [ 2 3; 1 5];
t = 1:1:10
for i = 1:1:10
     y = M * C
     plot (t, y)
     y1 = max(y)     
     y2 = max(y1(1,:)) %   scalar
  end
     y3 = max(y2) %  this is the max among all values of y for all steps
                  %  for y3 i want to know its belong to which row in y2 ?
Thanks for your help, your help always appreciated
0 comentarios
Respuesta aceptada
  Walter Roberson
      
      
 el 24 de Mayo de 2013
        1) Before your plot() call, insert
figure();
2)
In the loop,
y2(i) = max(y1(1,:));
After the loop,
[y3, y3row] = max(y2);
6 comentarios
  Image Analyst
      
      
 el 29 de Mayo de 2013
				The way you wrote the code, there is only one C so it will use only that one C.
Más respuestas (1)
Ver también
Categorías
				Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


