MATLAB简单程序大全

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

MATLAB简单程序大全求特征值特征向量

A=[2 3 4;1 5 9;8 5 2]

det(A)

A'

rank(A)

inv(A)

rref(A)

eig(A)%求特征值和特征向量

卫星运行问题

h=200,H=51000,R=6378;

a=(h+H+2*R)/2;

c=(H-h)/2;

b=(a^2-c^2)^(1/2);

e=c/a;

f=sqrt(1-exp(2).*cos(t)^2);

l=int(f,t,0,pi/2)

L=4*a.*l

动态玫瑰线

n=3;N=10000;

theta=2*pi*(0:N)/N;

r=cos(n*theta);

x=r.*cos(theta);

y=r.*sin(theta);

comet(x,y)

二重积分

syms x y

f=x^2*sin(y);

int(int(f,x,0,1),y,0,pi)

ezmesh(f,[0,1,0,pi])

函数画图

syms x;f=exp(-0.2*x)*sin(0.5*x);

ezplot(f,[0,8*pi])

玫瑰线

theta=0:0.01:2*pi;

r=cos(3*theta);

polar(theta,r,'r')

求x^2+y^2=1和x^2+z^2=1所围成的体积

syms x y z R

r=1;

Z=sqrt(1-x^2);

y0=Z;

V=8*int(int(Z,y,0,y0),x,0,1)

求导数及图像

f='1/(5+4*cos(x))';

subplot(1,2,1);ezplot(f)

f1=diff(f)

subplot(1,2,2);ezplot(f1)

绕x轴旋转

t=(0:20)*pi/10;

r=exp(-.2*t).*sin(.5*t);

theta=t;

x=t'*ones(size(t));

y=r'*cos(theta);

z=r'*sin(theta);

mesh(x,y,z)

colormap([0 0 0])

某年是否闰年

year=input('input year:=');

n1=year/4;

n2=year/100;

n3=year/400;

if n1==fix(n1)&n2~=fix(n2)

disp('是闰年')

elseif n1==fix(n1)&n3==fix(n3)

disp('是闰年')

else

disp('不是闰年')

End

玫瑰线的绘制

theta=0:0.001:2*pi;

rho=2*cos(3*theta);

figure(1);polar(theta,rho)

x=rho.*cos(theta);

y=rho.*sin(theta);

figure(2);comet(x,y)

相遇问题

function k=moto(A,B)

if nargin==0,A=0;B=100;end va=10;vb=8;vc=60;

f=1;k=0;

while(B-A)>0.2

if f==1

tk=(B-A)/(vb+vc);

else

tk=(B-A)/(vc+va);

end

A=A+va*tk;

B=B-vb*tk;

f=-f;

k=k+1;

End

数学实验

syms x; x=1:100;

f(x)=exp(-0.2*x).*sin(0.5*x); syms x; x=1:100;

f(x)=exp(-0.2*x).*sin(0.5*x); plot(x,f(x))

syms x; x=0:0.1:2*pi;

f(x)=exp(-0.2*x)*sin(0.5*x); plot(x,f(x))

syms x; x=0:0.1:2*pi;

f(x)=exp(-0.2*x).*sin(0.5*x); plot(x,f(x))

syms x; x=0:0.1:2*pi;

f(x)=exp(-0.2*x).*sin(0.5*x); zplot(x,f(x))

clc

f=sym('sin(x)/x');

limit(f)

f1=sym('(1+a/x)^x')

limit(f1)

f1=sym('(1+a/x)^x'),x=inf; limit(f1)

clc

f1=sym('(1+1/x)^x');

limit(f1,'inf')

f1=sym('(1+1/x)^x');

limit(f1,'inf')

clc

f1=sym('(1+1/x)^x');

limit(f1,'x',inf)

Clc

相遇问题

A=0;B=100;

va=10;vb=8;vc=60;

f=1;k=0;

plot(A,0,'ro',B,0,'go'),hold on while(B-A)>0.2

if f==1

tk=(B-A)/(vb+vc);

else

tk=(B-A)/(vc+va);

end

A=A+va*tk;

B=B-vb*tk;

plot(A,0,'R.',B,0,'g.'),pause(1)

f=-f;k=k+1;

end

k,tk,A,B

数学实验

f=[0 9 13.5;0.1 0 0;0 0.2 0]

x=[100;100;100]

y=x

for n=1:3

x=f*x

y=[y,x]

end

y

figure(1),bar(y(1,:))

figure(2),bar(y(2,:))

figure(3),bar(y(3,:))

[p,d]=eig(f)

a=p(:,1)

b=a/sum(a)

x1=b*300

y1=x1

for n=1:3

x1=f*x1

y1=[y1,x1]

相关文档
最新文档