用matlab绘制对数图像,matlab图像绘制(进阶篇)

对数图形的绘制:

x = logspace(-1,1,100);

%在10^(-1)到10^(1)中取100个值

y = x.^2;

subplot(2,2,1); %用线性的方式画图

plot(x,y);

title('Plot');

subplot(2,2,2);

semilogx(x,y);%x轴取log (10^-1、10^0、10^1等间隔)

title('Semilogx');

subplot(2,2,3);

semilogy(x,y); %y 轴取log

title('Semilogy');

subplot(2,2,4);

loglog(x,y); %x轴和y 轴取Log

title('Loglog');

3a27a0e7e6988d0aea3925fb785249de.png

>> set(gca,'XGrid','on'):

a3c2a0aa9dd3cdcf2d99c7c41e954691.png

plotyy()  两个y轴:

clc;

clear;

x = 0:0.01:20;

y1 = 200*exp(-0.05*x).*sin(x);

y2 = 0.8*exp(-0.5*x).*sin(10*x);

[AX,H1,H2] = plotyy(x,y1,x,y2);

set(get(AX(1),'Ylabel'),'String','Left Y-axis');

set(get(AX(2),'Ylabel'),'String','Right Y-axis');

title('Labeling plotyy');

set(H1,'LineStyle','--');

set(H2,'LineStyle',':');

7dec992df4c86a93df985e91da611fdb.png

统计图

clc;

clear;

y = randn(1,1000);

%产生随机数

subplot(2,1,1);

hist(y,10);

%10个bins(就是会有10个柱形)

title('Bins = 10');

subplot(2,1,2);

hist(y,50);

title('Bins = 50');

abc9967219a101aa8861b20e3a8a2e2c.png

hist是看整体的情况,bar是看个别的情况。

clc;

clear;

x = [1 2 5 4 8];

y = [x;1:5];

subplot(1,3,1); bar (x); title('A bargraph of vector x');

subplot(1,3,2); bar(y); title('A bargraph of vector y');

subplot(1,3,3); bar3(y); title('A 3D bargraph');

cadb1b692f3521a5953e3b6adb950df7.png

088dbff801e20001882afa432b2a1df8.png

clc;

clear;

x = [1 2 5 4 8]

  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值