MATLAB2D绘图功能如何实现长尾词效果?
- 内容介绍
- 文章标签
- 相关推荐
本文共计305个文字,预计阅读时间需要2分钟。
使用MATLAB代码绘制函数图像,并保持图像窗口,代码如下:
matlabclc; close all; clear;x=linspace(0, 4, 10);y=x.^2 .* sin(x);figure hold onplot(x, y, 'b-', 'linewidth', 2)xlabel('x (seconds)')ylabel('y=x^2 * sin(x)')

clc;close all;clear;x =linspace(0,4*pi,10);y = x.^2.*sin(x);figurehold onplot(x,y,'b-','linewidth',2)plot(x,y,'r^','linewidth',2)xlabel('x (seconds)')ylabel('y = x^2*sin(x)')grid ontitle('x VS y an example plot')legend('y','y(data points)','location','best')axis([min(x) max(x) min(y) max(y)])text(2,-40,'The angle of the wheel \theta','color','r','FontSize',16,'FontName','Time News Roman')% histogram 直方图N = 2000;numBins = 20;sampleuniform = rand(1,N);sampleNorm = randn(1,N);figuresubplot(2,1,1)histogram(sampleuniform,numBins);%numBins默认是10个subplot(2,1,2)histogram(sampleNorm,numBins);%% plotyy 方便对变化范围差异较大的两幅图进行比较x2 = linspace(0,5*pi,20);y2 = x2.^3.*sin(x2);figurehold onplot(x,y)plot(x2,y2)figureplotyy(x,y,x2,y2)%% semilogxfiguresemilogx(x2,y2)grid on%%loglog()figurex3 = logspace(-1,2);%logspace(a,b)创建10^a到10^b之间分为50份默认的,logspace(a,b,n)创建10^a到10^b之间分为n份loglog(x3,exp(x3),'-s')grid on%% pie 饼图figuresales = [15 50 30 30 20];pie(sales)%% scatterfiguresubplot(2,1,1)scatter(x,y)subplot(2,1,2)plot(x,y,'b+')
本文共计305个文字,预计阅读时间需要2分钟。
使用MATLAB代码绘制函数图像,并保持图像窗口,代码如下:
matlabclc; close all; clear;x=linspace(0, 4, 10);y=x.^2 .* sin(x);figure hold onplot(x, y, 'b-', 'linewidth', 2)xlabel('x (seconds)')ylabel('y=x^2 * sin(x)')

clc;close all;clear;x =linspace(0,4*pi,10);y = x.^2.*sin(x);figurehold onplot(x,y,'b-','linewidth',2)plot(x,y,'r^','linewidth',2)xlabel('x (seconds)')ylabel('y = x^2*sin(x)')grid ontitle('x VS y an example plot')legend('y','y(data points)','location','best')axis([min(x) max(x) min(y) max(y)])text(2,-40,'The angle of the wheel \theta','color','r','FontSize',16,'FontName','Time News Roman')% histogram 直方图N = 2000;numBins = 20;sampleuniform = rand(1,N);sampleNorm = randn(1,N);figuresubplot(2,1,1)histogram(sampleuniform,numBins);%numBins默认是10个subplot(2,1,2)histogram(sampleNorm,numBins);%% plotyy 方便对变化范围差异较大的两幅图进行比较x2 = linspace(0,5*pi,20);y2 = x2.^3.*sin(x2);figurehold onplot(x,y)plot(x2,y2)figureplotyy(x,y,x2,y2)%% semilogxfiguresemilogx(x2,y2)grid on%%loglog()figurex3 = logspace(-1,2);%logspace(a,b)创建10^a到10^b之间分为50份默认的,logspace(a,b,n)创建10^a到10^b之间分为n份loglog(x3,exp(x3),'-s')grid on%% pie 饼图figuresales = [15 50 30 30 20];pie(sales)%% scatterfiguresubplot(2,1,1)scatter(x,y)subplot(2,1,2)plot(x,y,'b+')

