Matlab实验 ——绘图操作绘制函数曲线

%第五题
s=0:pi/50:pi/2;
t=0:pi/50:3*pi/2;

[s,t]=meshgrid(s,t);

x=cos(s).*cos(t);

y=cos(s).*sin(t);

z=sin(s);

colormap jet;

surf(x,y,z);
%第四题
z=cos(x).*cos(y).*exp(-sqrt(x.^2+y.^2)/4);
x=linspace(-5,5,21);
y=linspace(0,10,31);
[x,y]=meshgrid(x,y)
colormap jet;
subplot(2,1,1);
surf(x,y,z);
subplot(2,1,2);
surfc(x,y,z)
%3
x=(2+cos(t/2)).*cos(t);
y=(2+cos(t/2)).*sin(t);
z=sin(t/2);
t=0:pi/50:2*pi;
plot3(x,y,z)
%杆图
x=0:pi/50:2*pi;
y1=x.^2;
y2=cos(2*x);
y3=y1.*y2;
subplot(4,1,1);
stem(x,y1);
legend('y1=x.^2')
subplot(4,1,2);
stem(x,y2)
subplot(4,1,3);
stem(x,y3)
%阶梯
x=0:pi/50:2*pi;
y1=x.^2;
y2=cos(2*x);
y3=y1.*y2;
subplot(4,1,1);
stairs(x,y1);
legend('y1=x.^2')
subplot(4,1,2);
stairs(x,y2)
subplot(4,1,3);
stairs(x,y3)
%条形
x=0:pi/50:2*pi;
y1=x.^2;
y2=cos(2*x);
y3=y1.*y2;
subplot(4,1,1);
bar(x,y1);
legend('y1=x.^2')
subplot(4,1,2);
bar(x,y2)
subplot(4,1,3);
bar(x,y3)
%2.2
x=0:pi/50:2*pi;
y1=x.^2;
y2=cos(2*x);
y3=y1.*y2;
subplot(4,1,1);
plot(x,y1)
subplot(4,1,2);
plot(x,y2)
subplot(4,1,3);
plot(x,y3)
%2.1
x=0:pi/50:2*pi;
y1=x.^2;
y2=cos(2*x);
y3=y1.*y2;
plot(x,y1,'r',x,y2,'b*',x,y3,'gx')
%1.3
theta=0:0.01:2*pi;
rho=10*sin(1+5*theta)
polarplot(theta,rho)
%1.2
x=-5:0.1:5;
y=(x+sqrt(pi))/(exp(2)).*(x<=0)+1/2*log(x+sqrt(1+x.^2)).*(x>0);
plot(x,y)
%1.1
x=linspace(0,2*pi,101);
y=(0.5+3*sin(x)./(1+x.^2)).*cos(x);
plot(x,y)

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值