matlab plot函数用法汇总

%%%
% plot函数的使用

clear
clc
x = 0 : pi/100 : 2*pi;
y1 = cos(x)*2;
y2 = cos(x)*3;
y3 = cos(x)*4;
y4 = cos(x)*5;
z = [y1;y2;y3;y4];
plot(x,y1,x,y2,x,y3,x,y4);
figure(2);
plot(x,z);

%%
% peaks函数的使用方法
plot(peaks(50));

%%
% 复数数组绘图
% 以复数实部为x轴,虚部为y轴绘图
A = [0 + 0i,1 + 2i, 2 + 5i, 3 + 4i];
figure(3);
plot(A);
title('plot of a single complex array ');
xlabel(‘Real Component’);
ylabel(‘Imaginary Component’);

%%
% plot的输入是2个数组,则以第一个数组的实部
% 为x轴绘图,第二个数组的实部为y轴绘图
B = sin(A);
figure(4);
plot(A,B);
xlabel(‘Real Component of the x Array’);
ylabel(‘Real Component of the y Array’);
title(‘plot of 2 Complex Arrays’);

%%
%线条颜色和标记,注意使用‘’包含
x = [1 : 10];
y = [58.5,63.8,64.2,67.3,71.5,88.3,90.1,90.6,89.5,90.4];
plot(x,y,‘ko:’);
figure(2);
plot(x,y,’:ok’,x,y*2,’–xr’,x,y/2,’-b’);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值