Mmcc:aula 3
___________________________________________
scilab-5.1.1 Consortium Scilab (DIGITEO) Copyright (c) 1989-2009 (INRIA) Copyright (c) 1989-2007 (ENPC) ___________________________________________ Startup execution: loading initial environment
Índice
Vetores
--> // Comentario
-->x=[10 2 23 34 11]
x = 10. 2. 23. 34. 11.
-->size(x)
ans = 1. 5.
-->coluna=[12; 23; 11; 9]
coluna = 12. 23. 11. 9.
-->size(coluna) // verifica o tamanho do vetor
ans = 4. 1.
-->x(3)
ans = 23.
-->x
x = 10. 2. 23. 34. 11.
-->x(1,4) // na linha 1 e coluna 4
ans = 34.
-->M=[1 2; --> 2 3]
M = 1. 2. 2. 3.
-->M(2,1) = 4
M = 1. 2. 4. 3.
-->M'
ans = 1. 4. 2. 3.
--> // matriz transposta '
-->coluna
coluna = 12. 23. 11. 9.
-->y = coluna'
y = 12. 23. 11. 9.
-->y(1)=y(1)+1
y = 13. 23. 11. 9.
-->y = y + 2
y = 15. 25. 13. 11.
-->M
M = 1. 2. 4. 3.
-->M+2
ans = 3. 4. 6. 5.
-->M
M = 1. 2. 4. 3.
-->N=M+2
N = 3. 4. 6. 5.
-->x+y
!--error 8
Inconsistent addition. (Os vetores devem ter o mesmo tamanho)
-->x
x = 10. 2. 23. 34. 11.
-->y
y = 15. 25. 13. 11.
-->y(5)=0
y = 15. 25. 13. 11. 0.
-->x+y
ans = 25. 27. 36. 45. 11.
-->x= 1:100
x = column 1 to 8 1. 2. 3. 4. 5. 6. 7. 8. column 9 to 15 9. 10. 11. 12. 13. 14. 15. column 16 to 22 16. 17. 18. 19. 20. 21. 22. column 23 to 29 23. 24. 25. 26. 27. 28. 29. column 30 to 36 30. 31. 32. 33. 34. 35. 36. column 37 to 43 37. 38. 39. 40. 41. 42. 43. column 44 to 50 44. 45. 46. 47. 48. 49. 50. column 51 to 57 51. 52. 53. 54. 55. 56. 57. column 58 to 64 58. 59. 60. 61. 62. 63. 64. column 65 to 71 65. 66. 67. 68. 69. 70. 71. column 72 to 78 72. 73. 74. 75. 76. 77. 78. column 79 to 85 79. 80. 81. 82. 83. 84. 85. column 86 to 92 86. 87. 88. 89. 90. 91. 92. column 93 to 99 93. 94. 95. 96. 97. 98. 99. column 100 100.
-->x= 1:100;
-->pares = 2:2:100
pares = column 1 to 8 2. 4. 6. 8. 10. 12. 14. 16. column 9 to 15 18. 20. 22. 24. 26. 28. 30. column 16 to 22 32. 34. 36. 38. 40. 42. 44. column 23 to 29 46. 48. 50. 52. 54. 56. 58. column 30 to 36
-->pares = 2*x
pares = column 1 to 8 2. 4. 6. 8. 10. 12. 14. 16. column 9 to 15 18. 20. 22. 24. 26. 28. 30. column 16 to 22 32. 34. 36. 38. 40. 42. 44. column 23 to 29 46. 48. 50. 52. 54. 56. 58. column 30 to 36
Gráficos
-->plot( x )
-->x=-10:10;
-->y=2*x + 5;
-->plot( y )
-->clf
-->plot( y )
-->who_user
User variables are: clf y x ResetFigureDDM plot pares N M coluna home Using 7953 elements ouf of 4965245
-->plot(x, y)
-->clf
-->plot(x, y, 'r.')
-->plot(x, y)
-->y=x^2
y = column 1 to 7 100. 81. 64. 49. 36. 25. 16. column 8 to 15 9. 4. 1. 0. 1. 4. 9. 16. column 16 to 21 25. 36. 49. 64. 81. 100.
-->clf
-->plot(x, y, 'r.')
-->plot(x, y)
-->clf
-->y=sin(x);
-->plot(x,y)
-->plot(x, y, 'r.')
-->x=-10:0.2:10;
-->y=sin(x);
-->plot(x, y, 'b')
-->clf
-->plot(x, y, 'b*')
Gráfico da função raiz quadrada
-->clf
-->y= sqrt( x )
y = column 1 to 3 3.1622777i 3.1304952i 3.0983867i column 4 to 7 3.0659419i 3.0331502i 3.i 2.9664794i column 8 to 10 2.9325757i 2.8982753i 2.8635642i column 11 to 13 2.8284271i 2.792848i 2.7568098i column 14 to 16
-->
-->plot(x, y, 'b*')
-->xgrid \\ desenha um grid atrás da figura
Desenho de um triângulo
-->clf
-->x=[2 3 4];
-->y=[1 2 1];
-->plot(x,y)
-->x=[x x(1)]
x = 2. 3. 4. 2.
-->y=[y y(1)]
y = 1. 2. 1. 1.
-->plot(x,y)
Gráficos de equações
-->x=-3:.1:3;
-->y=x^2-1;
-->plot(x,y,'b.')
Gráfico de um círculo
-->clf
-->x=-2:.1:2;
-->y= sqrt( 1-x^2 );
-->plot(x,y,'b.-')
-->clf
-->x=-1:.1:1;
-->y= sqrt( 1-x^2 );
-->plot(x,y,'b.-')
-->y= -sqrt( 1-x^2 );
-->clf
-->plot(x,y,'b.-')
-->y= sqrt( 1-x^2 );
-->yneg= -sqrt( 1-x^2 );
-->clf
-->plot(x,y,'b.-')
-->plot(x,yneg,'b.-')