q=linspace(0,2*pi);
r=3*(1-cos(q));
polar(q,r)
t=linspace(0,2*pi);
y=1.25*exp(-0.25*t)+cos(3*t);
plot(x,y)
t=linspace(0,8);
y=1-2*exp(-t).*sin(t);
plot(t,y);
xlabel('Time'),
ylabel('Amplitude'),
title('Decaying Oscillating Exponential')
x=linspace(0,25);
y1=2.6*exp(-0.5*x).*cos(0.6*x)+0.8;
y2=1.6*cos(3*x)+sin(x);
plotyy(x,y1,x,y2)
x=linspace(0,2*pi);
y1=sin(2*x).*cos(3*x);
y2=0.4*x;
subplot(2,1,1),
plot(x,y1),
xlabel('x');ylabel('y');
title('y1=sin(2*x).*cos(3*x)')
matlab拟合数据
subplot(2,1,2),
plot(x,y2),
xlabel('x');ylabel('y');
title(' y2=0.4*x')
a=linspace(-3,3);
[x,y]=meshgrid(a);
z=1./((x+1).^2+(y+1).^2+1)-1./((x-1).^2+(y-1).^2+1);
surf(x,y,z)
a=-2:0.1:2;
[x,y]=meshgrid(a);
a=5;b=4;c=3;d=1;
z1=c.*sqrt(d-(x.^2)./(a.^2)-(y.^2)./(b.^2));
subplot(2,1,1),surf(x,y,z1)
a=5j;
z2=c.*sqrt(d-(x.^2)./(a.^2)-(y.^2)./(b.^2));
subplot(2,1,2),surf(x,y,z2)
r=linspace(0,1,50);
t=linspace(0,2*pi,50);
x=5*r'*cos(t);
y=4*r'*sin(t);
z=3*sqrt(1-(x/5).^2-(y/4).^2);
surf(x,y,z)

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。