matlab 问几个小问题 (基础问题)

来源:百度知道 编辑:UC知道 时间:2024/05/08 00:53:53
1,编制一个fu函数文件,函数关系为a(m,f)=f/m 再编制一个m文件,求出初速度为0的直线运动

2,在一个窗口中画出4幅图,分别绘制 sin2x,tanx,lnx,10^x的图形,并加上适当的修饰

3,某校1560名学生,其中aa系213人,bb系387人,cc,dd,ee (略) 分别画出饼图和条形图示意学生分布

4,画出如下三维网格图 x=-10:10 y=-8:8 z=(sinsqrt(x^2+y^2))/sqrt(x^2+y^2)

5,绘出f=x^2+e^y*abs(x) 在 x=-2:2 y=-2:2上的三维曲面图

%%%1题
%在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function a=fu(m,f)
a=f/m;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function x=motion(m,f,v0,x0,t)
a=f/m;
x=x0+v0*t+0.5*a*t.^2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%返回Matlab,输入:
t=0:0.01:1;
x=motion(1,9.8,0,0,t);
plot(t,x)
xlabel('t')
ylabel('x')

%%2题
subplot(2,2,1)
ezplot('sin(2*x)')
xlabel('x')
ylabel('sin(2x)')

subplot(2,2,2)
ezplot('tan(x)')
xlabel('x')
ylabel('tan(x)')

subplot(2,2,3)
ezplot('log(x)')
xlabel('x')
ylabel('log(x)')

subplot(2,2,4)
ezplot('10^x')
xlabel('x')
y