![how to use matlab p file how to use matlab p file](https://i.ytimg.com/vi/rL7apc-xmTk/maxresdefault.jpg)
doc file association configured to start Word. For example, if you select myfile.doc, Open Outside MATLAB opens myfile.doc in Microsoft Word, assuming you have the. To open a file using an external application, select Open Outside MATLAB from the context menu. To open a file in the Editor/Debugger, no matter what type it is, select Open as Text from the context menu. For example, the Editor/Debugger opens for M-files, and Simulink opens for model (.
How to use matlab p file code#
The following table shows the colors and their codes − Code MATLAB provides eight basic color options for drawing graphs. MATLAB generates the following graph − Setting Colors on Graph
![how to use matlab p file how to use matlab p file](https://in.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/46982/versions/1/screenshot.jpg)
The following example demonstrates the concept − Example You can draw multiple graphs on the same plot. MATLAB generates the following graph − Drawing Multiple Functions on the Same Graph The axis square command generates a square plot.
![how to use matlab p file how to use matlab p file](https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/60440/versions/2/screenshot.jpg)
The axis equal command allows generating the plot with the same scale factors and the spaces on both axes. The grid on command allows you to put the grid lines on the graph.
![how to use matlab p file how to use matlab p file](http://dstarena.com/blog/wp-content/uploads/2013/09/pfile.png)
The title command allows you to put a title on the graph. The xlabel and ylabel commands generate labels along x-axis and y-axis. MATLAB allows you to add title, labels along the x-axis and y-axis, grid lines and also to adjust the axes to spruce up the graph. MATLAB draws a smoother graph − Adding Title, Labels, Grid Lines and Scaling on the Graph Please note that as we decrease the increment, the graph becomes smoother.Ĭhange the code file a little, reduce the increment to 5 − In this example, we will draw two graphs with the same function, but in second time, we will reduce the value of increment. Let us take one more example to plot the function y = x 2. When you run the file, MATLAB displays the following plot − Let us plot the simple function y = x for the range of values for x from 0 to 100, with an increment of 5.Ĭreate a script file and type the following code − To plot the graph of a function, you need to take the following steps −ĭefine x, by specifying the range of values for the variable x, for which the function is to be plottedįollowing example would demonstrate the concept.