Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#2 |
初级会员
注册日期: 2007-07-03
帖子: 12
声望力: 18 ![]() |
![]()
1:
a: fid=fopen(‘d:\wyt.dat’,,’r+’); b: f=2.15678 fid=fopen(‘d:\wyt.txt’,,’at’); fprintf(fid,'\n%+12.5E\n',f); fclose(fid); c: fid2=fopen('d:\wyt.txt','rt'); B=fscanf(fid2,'%f',inf); fclose(fid2); 2: fid=fopen('d:\test.dat','w'); fprintf(fid,'\n NAME SCORE.\n Liuqi 84.0\n Zhangbin 87.5\n… Liping 90.0\n Wangwei 78.0 \n Wujian 92.5\n '); fclose(fid); 3: function test(n) x=0:0.1:2*n; y=sin(x).*cos(5*x); plot(x,y); end 4: function test1(n) x=0:0.1:2*n; y=abs(1000*sin(4*x))+1; semilogy(x,y,'-r*'); end 5: t=-6:0.1:2; ft=sin(t); plot(t,ft); fplot('sin',[-6 2]) 6: function testsurf(n) [x,y]=meshgrid(0:0.1:2*n); z=sin(x).*cos(y); surf(x,y,z); function testmesh(n) [x,y]=meshgrid(0:0.1:2*n); z=sin(x).*cos(y); mesh(x,y,z); |
![]() |
![]() |