数学建模作图.docx
《数学建模作图.docx》由会员分享,可在线阅读,更多相关《数学建模作图.docx(18页珍藏版)》请在冰豆网上搜索。
数学建模作图
x=linspace(0,4,10);
y=2*x.^3-9*x.^2+12*x-3;
plot(x,y)
saveas(gcf,'zuotu1.jpg')
x=linspace(0,8,10);
y=(x.^2).^(1/3);
plot(x,y)
saveas(gcf,'zuotu2.jpg')
functiony=f1(x)
ifx>0
y=2*x-1;
elseifx<=0
y=x.^2-1;
end
输入命令:
fplot('f1',[-3,3])
输入命令:
ezplot('x.^3+y.^3-3*x*y',[-2,0.5,2])
输入命令:
ezplot('5*t.^2','2*t.^3',[-2,2])
1.在同一坐标系下画出下列函数的曲线图(并进行详细标注)。
x=linspace(0,2*pi,30);
y1=0.2*[exp(0.1*x)]+sin(0.5*x);
plot(x,y1,'-.r*')
holdon
y2=0.2*[exp(0.1*x)]+cos(0.5*x);
plot(x,y2,':
bo')
title('y1(*)=0.2e.^(0.1x)+sin(0.5x),y2(o)=0.2e.^(0.1x)+cos(0.5x)')
legend('y1','y2')
saveas(gcf,'zuotu6.jpg')
x=linspace(-3,3,20);
y1=sqrt(x);
plot(x,y1,'g-')
holdon
y2=x.^2;
plot(x,y2,':
m>')
legend('y1','y2')
x=linspace(0,1,30);
y=[sqrt(x);x.^2]
fill(x,y,'y')
saveas(gcf,'zuotu7.jpg')
ezplot('(x.^2)/16+(y.^2)/7-1',[-55])
holdon
x=linspace(-5,5,20)
y=(2/3)*[x.^(3/2)]-(x.^3)/3;
plot(x,y,'-ko')
gtext('相交点1')
gtext('相交点2')
legend('y1','y2')
saveas(gcf,'zuotu8.jpg')
2.在同一页面上画出四幅下列图像(并且要详细标注,样式如右边)
clear
clc
subplot(2,2,1)
ezplot('x.^(2/3)+y.^(2/3)-2.^(2/3)',[-55])
subplot(2,2,2)
ezplot('x.^2+y.^2+2*x-2*sqrt(x.^2+y.^2)',[-55])
subplot(2,2,3)
ezplot('(x.^2+y.^2).^2-2*(x.^2-y.^2)',[-55])
subplot(2,2,4)
ezplot('(x.^2+y.^2).^2-4*x*y',[-55])
saveas(gcf,'zuotu9.jpg')
2.画出下列曲线并分别进行标注
(1)
输入命令:
ezplot('(3*t)/(1+t.^2)','(3*t.^2)/(1+t.^2)',[-18,18])
(2)
输入命令:
ezplot('log(1+t.^2)','t-atan(t)',[-2,2])
(3)
输入命令:
ezplot('1-t.^2','t-t.^3',[-2,2])
4.画出下图,并将其极值点及其拐点标出,
同时画出过拐点的切线,及其过极值点的法线
clear
clf
symst
x=linspace(-2,2.5,100);
y=x.^3-x.^2-x+1;
gridon
plot(x,y)
legend('y=x.^3-x.^2-x+1')
holdon
plot(-(1/3),32/27,'ro')
plot(1,0,'ro')
plot(1/3,16/27,'bo')
arrow([0-4],[08])
arrow([-40],[60])
[x0,y0]=ginput
(1)
plot(x0,y0,'b*')
gtext('拐点切线')
gtext('x轴')
gtext('y轴')
x1=[-1/3-1/3];
y1=[-1010];
x2=[1,1];
y2=[-1010];
plot(x1,y1,'--k',x2,y2,'--k')
z=diff(t.^3-t.^2-t+1);
z1=subs(z,t,1/3);
x3=[-2/3,4/3];
y3=z1*(x3-1/3)+16/27;
plot(x3,y3,'-k')
holdon
x4=[1/3,1/3];
y4=[016/27];
x5=[0,1/3];
y5=[16/2716/27];
plot(x4,y4,'--r',x5,y5,'--r')
axisoff
holdoff
saveas(gcf,'zuotu13.jpg')
clear
clf
symst
ezplot('1+36*x/(x+3).^2',[-40,40])
holdon
plot(3,4,'ro')
plot(6,11/3,'bo')
arrow([0-5],[05])
arrow([-500],[500])
[x1,y1]=ginput
(1)
plot(x1,y1,'b*')
gtext('拐点切线')
gtext('x轴')
gtext('y轴')
x2=[33];
y2=[-1010];
plot(x2,y2,'--k')
z=diff('1+36*t/(t+3)^2')
z1=subs(z,t,6);
x3=[-4,16];
y3=z1*(x3-6)+11/3;
plot(x3,y3,'-k')
holdon
x4=[6,6];
y4=[011/3];
x5=[0,6];
y5=[11/311/3];
plot(x4,y4,'--r',x5,y5,'--r')
axisoff
holdoff
saveas(gcf,'zuotu14.jpg')
5.设法用matlab画出下列图形
圆的参数方程以及椭圆的参数方程如下:
ezplot('5*cos(t)','5*sin(t)',[-pi,pi])
holdon
x1=[-33];
y1=[44];
x2=[-33];
y2=[-4-4];
plot(x1,y1,'-k',x2,y2,'-k')
holdon
x3=[33];
y3=[4-4];
x4=[-3-3];
y4=[4-4];
plot(x3,y3,'-k',x4,y4,'-k')
holdon
x5=[-33];
y5=[4-4];
plot(x5,y5,'-k')
axis([-55-55])
axisoff
saveas(gcf,'zuotu15.jpg')
ezplot('5*cos(t)','5*sin(t)+2',[-pi,pi])
holdon
ezplot('2*cos(t)','2*sin(t)+2',[-pi,pi])
holdon
ezplot('5*cos(t)','2*sin(t)+2',[-pi,pi])
arrow([0-8],[08])
arrow([-80],[80])
axisoff
saveas(gcf,'zuotu16.jpg')
ezplot('5*cos(t)','5*sin(t)',[-pi,pi])
holdon
x1=[-5*sin(2*pi/5),0];
y1=[5*sin(pi/10),5];
x2=[0,5*sin(2*pi/5)];
y2=[5,5*sin(pi/10)];
plot(x1,y1,x2,y2)
x3=[-5*sin(pi/5),5*sin(pi/5)];
y3=[-5*cos(pi/5),-5*cos(pi/5)];
x4=[-5*sin(2*pi/5),-5*sin(pi/5)];
y4=[5*sin(pi/10),-5*cos(pi/5)];
x5=[5*sin(pi/5),5*sin(2*pi/5)];
y5=[-5*cos(pi/5),5*sin(pi/10)];
plot(x3,y3,x4,y4,x5,y5)
x=[x1,x2,x3,x4,x5];
y=[y1,y2,y3,y4,y5];
fill(x,y,'-')
axisoff
saveas(gcf,'zuotu17.jpg')