Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. package grafikag;
  2.  
  3. import Jama.Matrix;
  4. import ptolemy.plot.Plot;
  5. import ptolemy.plot.PlotApplication;
  6.  
  7. public class Main {
  8.  
  9. public static void mygraph(double[][] points) {
  10. Plot myPlot = new Plot();
  11. myPlot.setTitle("Plot example");
  12. myPlot.setXLabel("x");
  13. myPlot.setYLabel("s(x)");
  14. int dl = points.length;
  15. myPlot.setMarksStyle("dots", 0);
  16. //myPlot.setImpulses(true, 0);
  17. //for(int i=0; i<ticks.length; i++) myPlot.addXTick("",ticks[i][0]);
  18. for (int i = 0; i < dl; i++) myPlot.addPoint(0, points[i][0], points[i][1], false);
  19. PlotApplication app = new PlotApplication(myPlot);
  20. app.setSize(800, 400);
  21. app.setLocation(100, 100);
  22. app.setTitle("MyPicture");
  23. }
  24.  
  25. public static void main(String[] args) {
  26. int i = 3, j = 3;
  27. Matrix A = Matrix.random(i, j);
  28. Matrix B = Matrix.random(j, 1);
  29.  
  30. Matrix D = new Matrix(i, j);
  31. Matrix R = new Matrix(i, j);
  32.  
  33. for (int k = 0; k < i; k++) {
  34. for (int w = 0; w < j; w++) {
  35. if(k==w)
  36. {
  37. D.set(k,w, A.get(k,w));
  38. R.set(k,w, 0);
  39. } else {
  40. R.set(k,w, A.get(k,w));
  41. D.set(k,w, 0);
  42. }
  43. }
  44. }
  45.  
  46. A.print(i,j);
  47. B.print(i,j);
  48. D.print(i,j);
  49. R.print(i,j);
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement