資源簡(jiǎn)介
matlabSimulink程序源代碼和模型.zip

代碼片段和文件信息
%?ch1example1prg1.m
g=9.8;??%?重力加速度
v=0;????%?設(shè)定初始速度條件
s=0;????%?設(shè)定初始位移條件
t=0;????%?設(shè)定起始時(shí)間
dt=0.1;?%?設(shè)置計(jì)算步長(zhǎng)
N=20;???%?設(shè)置仿真遞推次數(shù).?仿真時(shí)間等于N與dt的乘積
for?k=1:N
??v=v+g*dt;?????????????????%?計(jì)算新時(shí)刻的速度
??s(k+1)=s(k)+v*dt;?????????%?新位移
??t(k+1)=t(k)+dt;???????????%?時(shí)間更新
end
%?理論計(jì)算?以便與仿真結(jié)果對(duì)照
t_theory=0:0.01:N*dt;???????%?設(shè)置解析計(jì)算的時(shí)間點(diǎn)
v_theory=g*t_theory;????????%?解析計(jì)算的瞬時(shí)速度
s_theory=1/2*g*t_theory.^2;?%?解析計(jì)算的瞬時(shí)位移
%?作圖:?仿真結(jié)果與解析結(jié)果對(duì)比
t=0:dt:N*dt;
plot(ts‘o‘?t_theorys_theory?‘-‘);
xlabel(‘時(shí)間?t‘);?ylabel(‘位移?s‘);
legend(‘仿真結(jié)果‘‘理論結(jié)果‘);
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????8789??2007-07-02?17:58??algebraiclooptest.mdl
?????文件???????13247??2007-06-30?13:37??AnalogtoDigitalandDA_Demo.mdl
?????文件???????15196??2007-06-30?12:24??AnalogtoDigitalandRateConverterDemo.mdl
?????文件?????????681??2007-10-22?19:42??ch1example1prg1.m
?????文件?????????621??2007-06-19?07:23??ch1example1prg2.m
?????文件?????????645??2007-06-23?08:00??ch1example2prg1.m
?????文件?????????600??2007-06-19?07:27??ch1example2prg2.m
?????文件?????????924??2007-06-19?07:32??ch1example3prg1.m
?????文件?????????394??2007-10-22?12:50??ch1example3prg2.m
?????文件????????1106??2007-06-19?07:35??ch1example4prg1.m
?????文件?????????987??2007-10-22?12:49??ch2example10prg1.m
?????文件?????????422??2007-10-14?18:33??ch2example10statefun.m
?????文件????????1383??2007-10-22?12:49??ch2example11prg1.m
?????文件?????????547??2007-06-24?14:16??ch2example11statefun.m
?????文件????????7658??2007-06-25?16:11??ch2example12.mdl
?????文件???????13160??2007-06-25?17:41??ch2example12mdl2.mdl
?????文件???????14612??2007-06-26?07:52??ch2example13.mdl
?????文件???????15602??2007-06-26?11:14??ch2example14.mdl
?????文件????????9893??2007-06-27?08:04??ch2example15.mdl
?????文件????????1262??2007-06-27?08:35??ch2example15data.txt
?????文件????????1914??2007-10-07?12:54??ch2example15Sfun.m
?????文件?????????335??2007-06-27?08:26??ch2example15SfunB.m
?????文件????????8088??2007-06-27?10:50??ch2example16.mdl
?????文件???????33873??2007-06-27?11:19??ch2example16sfun.c
?????文件???????24576??2007-06-27?11:19??ch2example16Sfun.dll
?????文件????????1343??2007-06-27?11:19??ch2example16sfun.h
?????文件????????1914??2007-10-07?12:54??ch2example16Sfun.m
?????文件????????6483??2007-06-27?11:19??ch2example16sfun_mex.c
?????文件????????9191??2007-06-27?14:10??ch2example17.mdl
?????文件????????1350??2007-10-07?12:54??ch2example17Sfun.m
?????文件????????9919??2007-06-27?17:35??ch2example18A.mdl
............此處省略177個(gè)文件信息
評(píng)論
共有 條評(píng)論