Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package grafikag;
- import Jama.Matrix;
- import ptolemy.plot.Plot;
- import ptolemy.plot.PlotApplication;
- public class Main {
- public static void mygraph(double[][] points) {
- Plot myPlot = new Plot();
- myPlot.setTitle("Plot example");
- myPlot.setXLabel("x");
- myPlot.setYLabel("s(x)");
- int dl = points.length;
- myPlot.setMarksStyle("dots", 0);
- //myPlot.setImpulses(true, 0);
- //for(int i=0; i<ticks.length; i++) myPlot.addXTick("",ticks[i][0]);
- for (int i = 0; i < dl; i++) myPlot.addPoint(0, points[i][0], points[i][1], false);
- PlotApplication app = new PlotApplication(myPlot);
- app.setSize(800, 400);
- app.setLocation(100, 100);
- app.setTitle("MyPicture");
- }
- public static void main(String[] args) {
- int i = 3, j = 3;
- Matrix A = Matrix.random(i, j);
- Matrix B = Matrix.random(j, 1);
- Matrix D = new Matrix(i, j);
- Matrix R = new Matrix(i, j);
- for (int k = 0; k < i; k++) {
- for (int w = 0; w < j; w++) {
- if(k==w)
- {
- D.set(k,w, A.get(k,w));
- R.set(k,w, 0);
- } else {
- R.set(k,w, A.get(k,w));
- D.set(k,w, 0);
- }
- }
- }
- A.print(i,j);
- B.print(i,j);
- D.print(i,j);
- R.print(i,j);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement