Plotting with MATLAB
Main.MatlabPlots History
Hide minor edits - Show changes to markup
(:html:)
<div id="disqus_thread"></div> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
(:htmlend:)
clear all; close all; clc x = linspace(0,6); y = sin(x); z = cos(x); h = figure(1); plot(x,y,'r--') hold on plot(x,z,'b.-','LineWidth',3) xlabel('x') ylabel('values') legend('y','z') xlim([0 3]); ylim([-1.5 1.5]); saveas(h,'myPlot.png') saveas(h,'myPlot.eps')
(:source lang=matlab:) clear all; close all; clc x = linspace(0,6); y = sin(x); z = cos(x); h = figure(1); plot(x,y,'r--') hold on plot(x,z,'b.-','LineWidth',3) xlabel('x') ylabel('values') legend('y','z') xlim([0 3]); ylim([-1.5 1.5]); saveas(h,'myPlot.png') saveas(h,'myPlot.eps') (:sourceend:)
Resize Plot and Save Figures
(:source lang=matlab:) clear all; close all; clc
x = linspace(0,10); y = sin(x);
p1 = figure('rend','painters','pos',[10 10 900 600]); plot(x,y) legend('sin(x)') ylabel('sin(x)') xlabel('x') saveas(p1,'myFigure1.png')
p2 = figure('rend','painters','pos',[10 10 300 200]); plot(x,y) legend('sin(x)') ylabel('sin(x)') xlabel('x') saveas(p2,'Fig2_for_screens.png') saveas(p2,'Fig2_for_documents.eps') (:sourceend:)
<iframe width="560" height="315" src="https://www.youtube.com/embed/abL-fDq4p_o" frameborder="0" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/rheDZt_tyn0" frameborder="0" allowfullscreen></iframe>
Tutorial MATLAB Source Code
clear all; close all; clc x = linspace(0,6); y = sin(x); z = cos(x); h = figure(1); plot(x,y,'r--') hold on plot(x,z,'b.-','LineWidth',3) xlabel('x') ylabel('values') legend('y','z') xlim([0 3]); ylim([-1.5 1.5]); saveas(h,'myPlot.png') saveas(h,'myPlot.eps')
Additional Tutorials
(:title Plotting with MATLAB:) (:keywords big data, data analysis, Microsoft Excel, spreadsheet, nonlinear, graph, scatter plot, university course:) (:description Plot data with MATLAB and export for a presentation or report:)
Effective plots are important to synthesize the information into relevant and persuasive information. The following tutorial details some of the common data plotting functions within MATLAB.
(:html:) <iframe width="560" height="315" src="https://www.youtube.com/embed/abL-fDq4p_o" frameborder="0" allowfullscreen></iframe> (:htmlend:)
This tutorial can also be completed with scripting programming languages like Excel and Python. Click on the appropriate link for additional information and source code.
(:html:)
<div id="disqus_thread"></div> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
(:htmlend:)