Software: matlabr2014a Codeblock
1. Create a new project
2. Enter the program, obtain the coordinates and save to TXT file
3. Using MATLAB to build a M file
4. Enter the drawing code,
5. Click Run, the M file is saved in the folder where the new project is located
6. Drawing complete
7. If you want to save the image in a different format, click on Save As, select Save Type, here to select the PDF format, this is the saved image.
Summary: Originally very simple things, the class after listening to no hands-on practice, a classmate asked to find that they did not remember,-_-#
Take a good look at yourself.
CPP Source code:
Practical Application---Function image # include <iostream> #include <fstream>//input/output stream # include <cmath>using namespace Std;int Main () {Ofstream out_y ("Y.txt"); Ofstream---Output stream, out--object Ofstream out_x ("X.txt"); int i,m=100;float dx=0.2;for (i=0;i<=m;i++) {OUT_X<<I*DX << ' \ t '; Out_y<<sin (i*dx) << ' \ t ';} Out_x.close (); Out_y.close (); return 0;}
Matlab code:
Load X.txtload y.txtplot (x, y)
Using MATLAB and C + + program generated data files to draw the Sin function