게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
matlab파일 인데요~ 무슨 소리인지 하나도 모르겠어요 ㅠㅠ
게시물ID : jisik_65176짧은주소 복사하기
작성자 : 장기수
추천 : 0
조회수 : 502회
댓글수 : 1개
등록시간 : 2009/09/15 00:29:46
sample1.m

 

clear

[i_file]=fopen('input_3_1.m','r')
[sname count]=fscanf(i_file,'%s \n',[1]);
[sno count]=fscanf(i_file,'%s\n',[1]);
[m count]=fscanf(i_file,'%d\n',[1]);
[cd count]=fscanf(i_file,'%f\n',[1]);
[t count]=fscanf(i_file,'%f\n',[1]);
fclose(i_file)


v=freefallvel(m, cd, t)%


 

o_file=fopen('outnut_3_1.m','w');
fprintf(o_file,'\n\nMokpo National Maritime University\n');
fprintf(o_file,'Division of Marine Engineering\n\n');
fprintf(o_file,'Student name     : %s\n',sname);
fprintf(o_file,'Student number   : %s\n',sno);
fprintf(o_file,'\n Numerical analysis for example 3.1(page38)\n\n');
fprintf(o_file,'Input data\n\n mass(kg) :              %d',m);
fprintf(o_file,'\n drag coefficient(kg/m) : %d',cd);
fprintf(o_file,'\n time(sec)              : %d',t);
fprintf(o_file,'\n velocity(m/s)          : %f',v);
fclose(o_file);
%
tt=[0:0.1:t];
n=length(tt);
for i=1:n
    t=tt(i);
    v=freefallvel(m, cd, t);
    vv(i)=v;
end
figure(1)
plot(tt,vv)
title('the free fall velocity of an object with second order drag')
xlabel('time(sec)')
ylabel('velocity(m/s)')
grid on

 

 

input_3_1.m

honggildong
20081234
69
0.25
50

 

 

 

freefallvel.m

function v= freefallvel(m, cd, t)

g=9.807; %acceleration of gravity
v=sqrt(g*m/cd*tanh(sqrt(g*cd/m)*t));


외부에서 파일을 읽어온다는 소리라는데.. 강의시간에 도저히 못따라 가겠어요..
이 함수가 이런 기능이고 저런 기능이고 하는것 정도만 알려주시면 안될까요..
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호