Guest User

Untitled

a guest
Mar 23rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. try {
  2. Future<MatlabEngine> eng = MatlabEngine.startMatlabAsync();
  3. MatlabEngine ml = eng.get();
  4. ml.eval("x = 0:pi/100:2*pi;");
  5. ml.eval("y = sin(x);");
  6. ml.eval("y2 = sin(x-.25);");
  7. ml.eval("y3 = sin(x-.5);");
  8. ml.eval("plot(x, y, x, y2, x, y3);");
  9.  
  10. //plotのあと軸を追加
  11. ml.eval("xlabel('x = 0:2\\pi');");
  12. ml.eval("ylabel('Sine of x');");
  13. ml.eval("title('Plot of the Sine Function','FontSize',12);");
  14. ml.eval("legend('sin(x)','sin(x-.25)','sin(x-.5)')");
  15. ml.eval("saveas(gcf,'sample.png')");
  16. ml.eval("pause(30);");
  17.  
  18. }
Add Comment
Please, Sign In to add comment