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+')
【文章原创作者:盐城网站制作公司 http://www.1234xp.com/yancheng.html 欢迎留下您的宝贵建议】