beginner: writing a function for code
显示 更早的评论
what would this be in writing a function called "event detection algorithm"
%%2.2 Calculation of Jump Height Data
% make the data positive, set a threshold (including noise) for
% baseline. tnf = total number of frames
% =================================================================
fz = -data(:,1);
fzmin= min(fz);
fzthres= fzmin+5+n; %%sets threshold
to= find(fz<fzthres,1,'first'); %%take-off
td= find(fz(to:end)>fzthres,1,'first'); %%touch-down
td= td+to -1; %%point of landing, global number
tnf= (td-to); %%jumper in the air
tof= (tnf*fr); %%time of flight eq
jh(i,1)=(-g*(tof.^2)/8); %%jump height eq
fzminMN = nanmean(fz(to:td)); %%mean min across time part
fz= fz + abs(fzminMN);
回答(1 个)
Image Analyst
2014-5-20
0 个投票
I would call this just "a chunk of code" though some people may use different terminology. Why do you ask?
4 个评论
Adrienne
2014-5-20
Image Analyst
2014-5-20
Sure, you can wrap up any chunk of code into a function if you want. See this link for more ideas : http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab
Adrienne
2014-5-20
Adrienne
2014-5-20
类别
在 帮助中心 和 File Exchange 中查找有关 Fixed-Point Math Operations in MATLAB and Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!