MATLAB程序设计与应用刘卫国(第三版)课后实验答案——7

这篇博客详细解答了《MATLAB程序设计与应用》刘卫国第三版中的第七次课后实验题目,覆盖了一到五部分的内容,包括线性代数问题和矩阵操作的MATLAB实现。
摘要由CSDN通过智能技术生成

MATLAB程序设计与应用刘卫国(第三版)课后实验答案——7

x=linspace(0,2*pi,101);
y=(0.5+3.*sin(x)./(1+x.^2)).*cos(x);
plot(x,y)

在这里插入图片描述

x=-5:0.01:5;
y=((x+sqrt(pi))/exp(2)).*(x<=0)+(0.5.*log(x+sqrt(1+x.^2))).*(x>0);
plot(x,y)

在这里插入图片描述

theta=0:pi/100:2*pi;
a=input('输入a=');
b=input('输入b=');
c=input('输入c=');
rho=a.*sin(b+c.*theta);
polar(theta,rho,'m')

在这里插入图片描述

x=-pi:pi/100:pi;
y1=x.^2;
y2=cos(2*x);
y3=y1.*y2;
plot(x,y1,'b-',x,y2,'r',x,y3,'k--');

在这里插入图片描述

x=-pi:pi/100:pi;
y1=x.^2;
y2=cos(2*x);
y3=y1.*y2;
subplot(1,3,1);
plot(x,y1,'b-');
title('y1=x^2');
subplot(1,3,2);
plot(x,y2,'r:');
title('y2=cos(2x)');
subplot(1,3,3);
plot(x,y3,'k--');
title('y3=y1*y2');

在这里插入图片描述

x=-pi:pi/100:pi;
y1=x.^2;
y2=cos(2*x);
y3=y1.*y2;
subplot(2,2,1);
plot(x,y1,'b-',x,y2,'r:',x,y3,'k--');
subplot(2,2,2);
bar(x,y1,'b');%此处条形图改为stairs;杆图为stem;填充图为fill
title('y1=x^2');
subplot(2,2,3);
bar(x,y2,'r');
subplot(2,2,4);
bar(x,y3,'k');
title('y3=y1*y2');

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

t=0:pi/100:2*pi;
x=(2+cos(t./2)).*cos(t);
y=(2+cos(t./2)).*sin(t);
z=sin(t./2);
plot3(x,y,z,'p');
title('3D picture');
xlabel('X'),ylabel('Y'),zlabel('Z');grid;

在这里插入图片描述

x=linspace(-5,5,21);
y=linspace(0,10,31);
[x,y]=meshgrid(x,y);
z=cos(x).*cos(y).*exp(-sqrt(x.^2+y.^2)/4);
subplot(2,1,1);
surf(x,y,z);
title('曲面图');
subplot(2,1,2);
surfc(x,y,z);
title('等高线图')

在这里插入图片描述

s=0:pi/100:pi/2;
t=0:pi/100:3*pi/2;
[s,t]=meshgrid(s,t);
x=cos(s).*cos(t);
y=cos(s).*sin(t);
z=sin(s);
subplot(2,2,1);
mesh(x,y,z);
title('未着色');
subplot(2,2,2);
surf(x,y,z);
title('缺省');
subplot(2,2,3);
surf(x,y,z);
shading flat;
title('shading flat');
subplot(2,2,4);
surf(x,y,z);
shading interp;
title('shading interp');

在这里插入图片描述

  • 35
    点赞
  • 143
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值