Just compiled a simple drawingProgram,CodeAs follows:
Close all;
CLC;
Clear;
% SiNx
X = linspace (200 * Pi );
F1 = sin (X );
Plot (x, F1 );
Title ('plot of F_1 = sin (x )');
Xlabel ('x ');
Ylabel ('f _ 1 ');
Axis ([0 2 * pi-1.1 1.1]);
% Cos (X)
F2 = cos (X );
Figure;
Plot (x, F2 );
Title ('plot of F_2 = cos (x )');
Xlabel ('x ');
Ylabel ('f _ 2 ');
Axis ([0 2 * pi-1.1 1.1]);
% Plot on the same pic
Figure;
Plot (x, F1, '-go ')
Hold on;
Plot (x, F2, '-R ^ ');
Title ('plots of F_1 = sin (x), F_2 = cos (x )');
Xlabel ('x ');
Ylabel ('f _ 1, F_2 ');
Axis ([0 2 * pi-1.1 1.1]);
Legend ('f _ 1', 'f _ 2 ');
Gtext ('f _ 1 = F_2 at two places ');
As a result, I saved it as the plot. M file. After the execution, it always appears ?? Attempt to execute script plot as a function prompt, the result is carefully searched for the reason that the file name is incorrect to plot2d or any other can be changed, cannot be named using the built-in function name of Matlab.