MATLAB显函数作图 参数方程作图 极坐标方程作图绘图实例 用 Matlab 绘制高颜值函数图像 放大看告别浓浓锯齿风
生活随笔
收集整理的這篇文章主要介紹了
MATLAB显函数作图 参数方程作图 极坐标方程作图绘图实例 用 Matlab 绘制高颜值函数图像 放大看告别浓浓锯齿风
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.1??顯函數作圖
1.2? 參數方程作圖
1.3??極坐標方程作圖
1.1??顯函數作圖
圖1.??
圖2.
% Eg001 % fplot 用法 clf x = linspace(-6,6,10000); y = sin(pi./x); subplot(2,1,1) plot(x,y,'linewidth',0.8) hold on plot([-6 6],[0 0],':r') axis image axis equal grid on box off title('\fontsize{16}\it plot 繪制 y = sin (\pi/x)') xlabel('\fontsize{16}\it x') ylabel('\fontsize{16}\it y') subplot(2,1,2) fplot(@(x) sin(pi./x),[-6,6],'linewidth',0.8) hold on plot([-6 6],[0 0],':r') axis equal box off grid on title('\fontsize{16}\it fplot 繪制 y = sin (\pi/x)') xlabel('\fontsize{16}\it x') ylabel('\fontsize{16}\it y') % clf % x = linspace(-3,3,500); % y = sin(pi./x); % axis([-3,3,-1.5,1.5]) % plot(x,y,'linewidth',1.5) % axis equal% clf % fplot(@(x) sin(pi./x),[-6,6],'linewidth',0.5) % axis([-6,6,-1.5,1.5]) % axis equal%axis fill?圖 3??y =?sinx 6個周期的圖像
% Eg002 % sinx % 6個周期================================================================================= clffplot(@(x) sin(x),[-6*pi,6*pi],'linewidth',2.5,'color','m')% define, plotset(gca,'Xtick',[-4*pi,-3*pi,-2*pi,-pi,0,pi,2*pi,3*pi,4*pi],'Ytick',[-1,-0.5,0,0.5,10])% label set(gca,'XtickLabel',{'-4\pi';'-3\pi';'-2\pi';'-\pi';'0';'\pi';'2\pi';'3\pi';'4\pi'}) set(gca,'YtickLabel',{'-1';'-0.5';'0';'0.5';'1'})hold onplot([-6*pi 6*pi],[0 0],':r')% plotaxis equal box off grid on title('\fontsize{14}\it y = sin x')% label xlabel('\fontsize{14}\it x') ylabel('\fontsize{14}\it y')% 2個周期================================================================================= % clf % fp=fplot(@(x) sin(x),[-2*pi,2*pi],'linewidth',2.5,'color','m') % set(gca,'Xtick',[-2*pi,-pi,0,pi,2*pi],'Ytick',[-1,-0.5,0,0.5,10]) % set(gca,'XtickLabel',{'-2\pi';'-\pi';'0';'\pi';'2\pi';}) % set(gca,'YtickLabel',{'-1';'-0.5';'0';'0.5';'1'}) % axis equal % box off % grid on % title('\fontsize{14}\it y = sin x') % xlabel('\fontsize{14}\it x') % ylabel('\fontsize{14}\it y')?1.2? 參數方程作圖
參數方程作圖1
% Eg003 % 參數方程 clf xt = @(t) cos(9*t); yt = @(t) sin(10*t); fplot(xt,yt,'linewidth',1.5) axis equal squaretitle('\fontsize{14}\it x = cos 9t, y = sin 10t')?
?參數方程作圖2
% Eg004 % 參數方程2 clf x =@(t) 2.3*cos (10*t) + cos(23*t); y =@(t) 2.3*sin (10*t) - sin(23*t); fplot(x,y,[-3.5,3.5],'linewidth',1,'color','r')axis equal squaretitle('\fontsize{14}\it x = 2.3cos 10t + cos 23t, y = 2.3sin 10t - sin 23t')?
?1.3??極坐標方程作圖
% Eg005 % 極坐標方程clftheta = 0:0.01:2*pi; rho = sin(2*theta).*cos(2*theta);polarplot(theta,rho,'linewidth',1,'color','r')title('\fontsize{14}\it r = sin 2\theta cos 2\theta')?
注意:如果我們不使用 eps?格式的圖片,而是使用其它位圖格式的圖片例如? png,jpg?等格式,就會出現鋸齒: p lot p2??如何生成 eps 格式的圖像?
eps文件是矢量格式的,矢量格式的圖片放大后不會出現鋸齒,我們LATEX中應該使用矢量格式 的圖片。 2.1.用matlab繪制好圖像后,點擊打開圖形 (figure) 窗口 2.2.?點擊?“File?→ Save as” 2.3.?在彈出的對話框中選擇??“EPS file”??并確定。 函數的基本調用格式為: p3 如何將Matlab繪制的圖片插入TEX文檔中?
首先,要將eps 圖片與 TEX 源文件保存在同一路徑下。 例如,要將y = sinx的圖片插入到這里,可以用下面的命令: \begin{figure}[H] \centering \includegraphics[width=\textwidth]{sinx4T} \caption{$y= sin x$\ 4個周期的圖像}\label{sinx4t} \end{figure} plot(x,y x,y) ) 其中x 和y 為長度相同的向量,分別用于存儲 x坐標和 y 坐標 數據 。 p lot p lot 函數的基本調用格式為: p plot( plot(x,y x,y) ) 其中x 和y 為長度相同的向量,分別用于存儲 x坐標和 y 坐標 數據 。總結
以上是生活随笔為你收集整理的MATLAB显函数作图 参数方程作图 极坐标方程作图绘图实例 用 Matlab 绘制高颜值函数图像 放大看告别浓浓锯齿风的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: pinterest数据科学家访谈
- 下一篇: 易模3D建模教程 |手机也能编辑3D模型