matlab对数函数(怎么用matlab画对数函数_matlab以e为底的对数)

发布时间:2025-12-10 20:01:13 浏览次数:2

怎么用matlab画对数函数_matlab以e为底的对数-matlab对数函数怎么写

怎么用matlab画对数函数_matlab以e为底的对数对数图形的绘制: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…_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’);

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

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’,’:’);

统计图

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’);

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’);

clc;

clear;

x = [1 2 5 4 8]

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477