annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/@miremotion/miremotion.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function varargout = miremotion(orig,varargin)
wolffd@0 2 % Predicts emotion along three dimensions and five basic concepts.
wolffd@0 3 % Optional parameters:
wolffd@0 4 % miremotion(...,'Dimensions',0) excludes all three dimensions.
wolffd@0 5 % miremotion(...,'Dimensions',3) includes all three dimensions (default).
wolffd@0 6 % miremotion(...,'Activity') includes the 'Activity' dimension.
wolffd@0 7 % miremotion(...,'Valence') includes the 'Valence' dimension.
wolffd@0 8 % miremotion(...,'Tension') includes the 'Tension' dimension.
wolffd@0 9 % miremotion(...,'Dimensions',2) includes 'Activity' and 'Valence'.
wolffd@0 10 % miremotion(...,'Arousal') includes 'Activity' and 'Tension'.
wolffd@0 11 % miremotion(...,'Concepts',0) excludes all five concepts.
wolffd@0 12 % miremotion(...,'Concepts') includes all five concepts (default).
wolffd@0 13 % miremotion(...,'Happy') includes the 'Happy' concept.
wolffd@0 14 % miremotion(...,'Sad') includes the 'Sad' concept.
wolffd@0 15 % miremotion(...,'Tender') includes the 'Tender' concept.
wolffd@0 16 % miremotion(...,'Anger') includes the 'Anger' concept.
wolffd@0 17 % miremotion(...,'Fear') includes the 'Fear' concept.
wolffd@0 18 % miremotion(...,'Frame',...) predict emotion frame by frame.
wolffd@0 19 %
wolffd@0 20 % Selection of features and coefficients are taken from a study:
wolffd@0 21 % Eerola, T., Lartillot, O., and Toiviainen, P.
wolffd@0 22 % (2009). Prediction of multidimensional emotional ratings in
wolffd@0 23 % music from audio using multivariate regression models.
wolffd@0 24 % In Proceedings of 10th International Conference on Music Information Retrieval
wolffd@0 25 % (ISMIR 2009), pages 621-626.
wolffd@0 26 %
wolffd@0 27 % The implemented models are based on multiple linear regression with 5 best
wolffd@0 28 % predictors (MLR option in the paper). The box-cox transformations have now been
wolffd@0 29 % removed until the normalization values have been established with a large sample of music.
wolffd@0 30 %
wolffd@0 31 % TODO: Revision of coefficients to (a) force the output range between 0 - 1 and
wolffd@0 32 % (b) to be based on alternative models and materials (training sets).
wolffd@0 33 %
wolffd@0 34 % Updated 03.05.2010 TE
wolffd@0 35 %
wolffd@0 36 frame.key = 'Frame';
wolffd@0 37 frame.type = 'Integer';
wolffd@0 38 frame.number = 2;
wolffd@0 39 frame.default = [0 0];
wolffd@0 40 frame.keydefault = [1 1];
wolffd@0 41 option.frame = frame;
wolffd@0 42
wolffd@0 43 dim.key = 'Dimensions';
wolffd@0 44 dim.type = 'Integer';
wolffd@0 45 dim.default = NaN;
wolffd@0 46 dim.keydefault = 3;
wolffd@0 47 option.dim = dim;
wolffd@0 48
wolffd@0 49 activity.key = 'Activity';
wolffd@0 50 activity.type = 'Boolean';
wolffd@0 51 activity.default = NaN;
wolffd@0 52 option.activity = activity;
wolffd@0 53
wolffd@0 54 valence.key = 'Valence';
wolffd@0 55 valence.type = 'Boolean';
wolffd@0 56 valence.default = NaN;
wolffd@0 57 option.valence = valence;
wolffd@0 58
wolffd@0 59 tension.key = 'Tension';
wolffd@0 60 tension.type = 'Boolean';
wolffd@0 61 tension.default = NaN;
wolffd@0 62 option.tension = tension;
wolffd@0 63
wolffd@0 64 arousal.key = 'Arousal';
wolffd@0 65 arousal.type = 'Boolean';
wolffd@0 66 arousal.default = NaN;
wolffd@0 67 option.arousal = arousal;
wolffd@0 68
wolffd@0 69 concepts.key = 'Concepts';
wolffd@0 70 concepts.type = 'Boolean';
wolffd@0 71 concepts.default = NaN;
wolffd@0 72 option.concepts = concepts;
wolffd@0 73
wolffd@0 74 happy.key = 'Happy';
wolffd@0 75 happy.type = 'Boolean';
wolffd@0 76 happy.default = NaN;
wolffd@0 77 option.happy = happy;
wolffd@0 78
wolffd@0 79 sad.key = 'Sad';
wolffd@0 80 sad.type = 'Boolean';
wolffd@0 81 sad.default = NaN;
wolffd@0 82 option.sad = sad;
wolffd@0 83
wolffd@0 84 tender.key = 'Tender';
wolffd@0 85 tender.type = 'Boolean';
wolffd@0 86 tender.default = NaN;
wolffd@0 87 option.tender = tender;
wolffd@0 88
wolffd@0 89 anger.key = 'Anger';
wolffd@0 90 anger.type = 'Boolean';
wolffd@0 91 anger.default = NaN;
wolffd@0 92 option.anger = anger;
wolffd@0 93
wolffd@0 94 fear.key = 'Fear';
wolffd@0 95 fear.type = 'Boolean';
wolffd@0 96 fear.default = NaN;
wolffd@0 97 option.fear = fear;
wolffd@0 98
wolffd@0 99 specif.option = option;
wolffd@0 100 specif.defaultframelength = 1;
wolffd@0 101 %specif.defaultframehop = .5;
wolffd@0 102
wolffd@0 103 specif.combinechunk = {'Average',@nothing};
wolffd@0 104 specif.extensive = 1;
wolffd@0 105
wolffd@0 106 varargout = mirfunction(@miremotion,orig,varargin,nargout,specif,@init,@main);
wolffd@0 107
wolffd@0 108
wolffd@0 109 %%
wolffd@0 110 function [x type] = init(x,option)
wolffd@0 111
wolffd@0 112 option = process(option);
wolffd@0 113
wolffd@0 114 if option.frame.length.val
wolffd@0 115 hop = option.frame.hop.val;
wolffd@0 116 if strcmpi(option.frame.hop.unit,'Hz')
wolffd@0 117 hop = 1/hop;
wolffd@0 118 option.frame.hop.unit = 's';
wolffd@0 119 end
wolffd@0 120 if strcmpi(option.frame.hop.unit,'s')
wolffd@0 121 hop = hop*get(x,'Sampling');
wolffd@0 122 end
wolffd@0 123 if strcmpi(option.frame.hop.unit,'%')
wolffd@0 124 hop = hop/100;
wolffd@0 125 option.frame.hop.unit = '/1';
wolffd@0 126 end
wolffd@0 127 if strcmpi(option.frame.hop.unit,'/1')
wolffd@0 128 hop = hop*option.frame.length.val;
wolffd@0 129 end
wolffd@0 130 frames = 0:hop:1000000;
wolffd@0 131 x = mirsegment(x,[frames;frames+option.frame.length.val]);
wolffd@0 132 elseif isa(x,'mirdesign')
wolffd@0 133 x = set(x,'NoChunk',1);
wolffd@0 134 end
wolffd@0 135 rm = mirrms(x,'Frame',.046,.5);
wolffd@0 136
wolffd@0 137 le = 0; %mirlowenergy(rm,'ASR');
wolffd@0 138
wolffd@0 139 o = mironsets(x,'Filterbank',15,'Contrast',0.1);
wolffd@0 140 at = mirattacktime(o);
wolffd@0 141 as = 0; %mirattackslope(o);
wolffd@0 142 ed = 0; %mireventdensity(o,'Option1');
wolffd@0 143
wolffd@0 144 fl = mirfluctuation(x,'Summary');
wolffd@0 145 fp = mirpeaks(fl,'Total',1);
wolffd@0 146 fc = 0; %mircentroid(fl);
wolffd@0 147
wolffd@0 148 tp = 0; %mirtempo(x,'Frame',2,.5,'Autocor','Spectrum');
wolffd@0 149 pc = mirpulseclarity(x,'Frame',2,.5); %%%%%%%%%%% Why 'Frame'??
wolffd@0 150
wolffd@0 151 s = mirspectrum(x,'Frame',.046,.5);
wolffd@0 152 sc = mircentroid(s);
wolffd@0 153 ss = mirspread(s);
wolffd@0 154 sr = mirroughness(s);
wolffd@0 155
wolffd@0 156 %ps = mirpitch(x,'Frame',.046,.5,'Tolonen');
wolffd@0 157
wolffd@0 158 c = mirchromagram(x,'Frame','Wrap',0,'Pitch',0); %%%%%%%%%%%%%%%%%%%% Previous frame size was too small.
wolffd@0 159 cp = mirpeaks(c,'Total',1);
wolffd@0 160 ps = 0;%cp;
wolffd@0 161 ks = mirkeystrength(c);
wolffd@0 162 [k kc] = mirkey(ks);
wolffd@0 163 mo = mirmode(ks);
wolffd@0 164 hc = mirhcdf(c);
wolffd@0 165
wolffd@0 166 se = mirentropy(mirspectrum(x,'Collapsed','Min',40,'Smooth',70,'Frame',1.5,.5)); %%%%%%%%% Why 'Frame'??
wolffd@0 167
wolffd@0 168 ns = mirnovelty(mirspectrum(x,'Frame',.1,.5,'Max',5000),'Normal',0);
wolffd@0 169 nt = mirnovelty(mirchromagram(x,'Frame',.2,.25),'Normal',0); %%%%%%%%%%%%%%%%%%%% Previous frame size was too small.
wolffd@0 170 nr = mirnovelty(mirchromagram(x,'Frame',.2,.25,'Wrap',0),'Normal',0); %%%%%%%%%%%%%%%%%%%% Previous frame size was too small.
wolffd@0 171
wolffd@0 172
wolffd@0 173
wolffd@0 174 x = {rm,le, at,as,ed, fp,fc, tp,pc, sc,ss,sr, ps, cp,kc,mo,hc, se, ns,nt,nr};
wolffd@0 175
wolffd@0 176 type = {'miremotion','mirscalar','mirscalar',...
wolffd@0 177 'mirscalar','mirscalar','mirscalar',...
wolffd@0 178 'mirspectrum','mirscalar',...
wolffd@0 179 'mirscalar','mirscalar',...
wolffd@0 180 'mirscalar','mirscalar','mirscalar',...
wolffd@0 181 'mirscalar',...
wolffd@0 182 'mirchromagram','mirscalar','mirscalar','mirscalar',...
wolffd@0 183 'mirscalar',...
wolffd@0 184 'mirscalar','mirscalar','mirscalar'};
wolffd@0 185
wolffd@0 186
wolffd@0 187 %%
wolffd@0 188 function e = main(x,option,postoption)
wolffd@0 189
wolffd@0 190 warning('WARNING IN MIRENOTION: The current model of miremotion is not correctly calibrated with this version of MIRtoolbox (but with version 1.3 only).');
wolffd@0 191
wolffd@0 192 option = process(option);
wolffd@0 193 rm = get(x{1},'Data');
wolffd@0 194 %le = get(x{2},'Data');
wolffd@0 195 at = get(x{3},'Data');
wolffd@0 196 %as = get(x{4},'Data');
wolffd@0 197 %ed = get(x{5},'Data');
wolffd@0 198 %fpp = get(x{6},'PeakPosUnit');
wolffd@0 199 fpv = get(x{6},'PeakVal');
wolffd@0 200 %fc = get(x{7},'Data');
wolffd@0 201 %tp = get(x{8},'Data');
wolffd@0 202 pc = get(x{9},'Data');
wolffd@0 203 sc = get(x{10},'Data');
wolffd@0 204 ss = get(x{11},'Data');
wolffd@0 205 rg = get(x{12},'Data');
wolffd@0 206 %ps = get(x{13},'PeakPosUnit');
wolffd@0 207 cp = get(x{14},'PeakPosUnit');
wolffd@0 208 kc = get(x{15},'Data');
wolffd@0 209 mo = get(x{16},'Data');
wolffd@0 210 hc = get(x{17},'Data');
wolffd@0 211 se = get(x{18},'Data');
wolffd@0 212 ns = get(x{19},'Data');
wolffd@0 213 nt = get(x{20},'Data');
wolffd@0 214 nr = get(x{21},'Data');
wolffd@0 215
wolffd@0 216
wolffd@0 217 e.dim = {};
wolffd@0 218 e.dimdata = mircompute(@initialise,rm);
wolffd@0 219 if option.activity == 1
wolffd@0 220 [e.dimdata e.activity_fact] = mircompute(@activity,e.dimdata,rm,fpv,sc,ss,se);
wolffd@0 221 e.dim = [e.dim,'Activity'];
wolffd@0 222 else
wolffd@0 223 e.activity_fact = NaN;
wolffd@0 224 end
wolffd@0 225 if option.valence == 1
wolffd@0 226 [e.dimdata e.valence_fact] = mircompute(@valence,e.dimdata,rm,fpv,kc,mo,ns);
wolffd@0 227 e.dim = [e.dim,'Valence'];
wolffd@0 228 else
wolffd@0 229 e.valence_fact = NaN;
wolffd@0 230 end
wolffd@0 231 if option.tension == 1
wolffd@0 232 [e.dimdata e.tension_fact] = mircompute(@tension,e.dimdata,rm,fpv,kc,hc,nr);
wolffd@0 233 e.dim = [e.dim,'Tension'];
wolffd@0 234 else
wolffd@0 235 e.tension_fact = NaN;
wolffd@0 236 end
wolffd@0 237
wolffd@0 238 e.class = {};
wolffd@0 239 e.classdata = mircompute(@initialise,rm);
wolffd@0 240 if option.happy == 1
wolffd@0 241 [e.classdata e.happy_fact] = mircompute(@happy,e.classdata,fpv,ss,cp,kc,mo);
wolffd@0 242 e.class = [e.class,'Happy'];
wolffd@0 243 else
wolffd@0 244 e.happy_fact = NaN;
wolffd@0 245 end
wolffd@0 246 if option.sad == 1
wolffd@0 247 [e.classdata e.sad_fact] = mircompute(@sad,e.classdata,ss,cp,mo,hc,nt);
wolffd@0 248 e.class = [e.class,'Sad'];
wolffd@0 249 else
wolffd@0 250 e.sad_fact = NaN;
wolffd@0 251 end
wolffd@0 252 if option.tender == 1
wolffd@0 253 [e.classdata e.tender_fact] = mircompute(@tender,e.classdata,sc,rg,kc,hc,ns);
wolffd@0 254 e.class = [e.class,'Tender'];
wolffd@0 255 else
wolffd@0 256 e.tender_fact = NaN;
wolffd@0 257 end
wolffd@0 258 if option.anger == 1
wolffd@0 259 [e.classdata e.anger_fact] = mircompute(@anger,e.classdata,rg,kc,se,nr);
wolffd@0 260 e.class = [e.class,'Anger'];
wolffd@0 261 else
wolffd@0 262 e.anger_fact = NaN;
wolffd@0 263 end
wolffd@0 264 if option.fear == 1
wolffd@0 265 [e.classdata e.fear_fact] = mircompute(@fear,e.classdata,rm,at,fpv,kc,mo);
wolffd@0 266 e.class = [e.class,'Fear'];
wolffd@0 267 else
wolffd@0 268 e.fear_fact = NaN;
wolffd@0 269 end
wolffd@0 270
wolffd@0 271 e = class(e,'miremotion',mirdata(x{1}));
wolffd@0 272 e = purgedata(e);
wolffd@0 273 fp = mircompute(@noframe,get(x{1},'FramePos'));
wolffd@0 274 e = set(e,'Title','Emotion','Abs','emotions','Ord','magnitude','FramePos',fp);
wolffd@0 275
wolffd@0 276 %%
wolffd@0 277 function option = process(option)
wolffd@0 278 if option.arousal==1
wolffd@0 279 option.activity = 1;
wolffd@0 280 option.tension = 1;
wolffd@0 281 if isnan(option.dim)
wolffd@0 282 option.dim = 0;
wolffd@0 283 end
wolffd@0 284 end
wolffd@0 285 if option.activity==1 || option.valence==1 || option.tension==1
wolffd@0 286 if isnan(option.activity)
wolffd@0 287 option.activity = 0;
wolffd@0 288 end
wolffd@0 289 if isnan(option.valence)
wolffd@0 290 option.valence = 0;
wolffd@0 291 end
wolffd@0 292 if isnan(option.tension)
wolffd@0 293 option.tension = 0;
wolffd@0 294 end
wolffd@0 295 if isnan(option.concepts)
wolffd@0 296 option.concepts = 0;
wolffd@0 297 end
wolffd@0 298 end
wolffd@0 299 if not(isnan(option.dim)) && option.dim
wolffd@0 300 if isnan(option.concepts)
wolffd@0 301 option.concepts = 0;
wolffd@0 302 end
wolffd@0 303 end
wolffd@0 304 if not(isnan(option.concepts)) && option.concepts
wolffd@0 305 if isnan(option.dim)
wolffd@0 306 option.dim = 0;
wolffd@0 307 end
wolffd@0 308 end
wolffd@0 309 if not(isnan(option.dim))
wolffd@0 310 switch option.dim
wolffd@0 311 case 0
wolffd@0 312 if isnan(option.activity)
wolffd@0 313 option.activity = 0;
wolffd@0 314 end
wolffd@0 315 if isnan(option.valence)
wolffd@0 316 option.valence = 0;
wolffd@0 317 end
wolffd@0 318 if isnan(option.tension)
wolffd@0 319 option.tension = 0;
wolffd@0 320 end
wolffd@0 321 case 2
wolffd@0 322 option.activity = 1;
wolffd@0 323 option.valence = 1;
wolffd@0 324 if isnan(option.tension)
wolffd@0 325 option.tension = 0;
wolffd@0 326 end
wolffd@0 327 case 3
wolffd@0 328 option.activity = 1;
wolffd@0 329 option.valence = 1;
wolffd@0 330 option.tension = 1;
wolffd@0 331 end
wolffd@0 332 end
wolffd@0 333 if isnan(option.activity)
wolffd@0 334 option.activity = 1;
wolffd@0 335 end
wolffd@0 336 if isnan(option.valence)
wolffd@0 337 option.valence = 1;
wolffd@0 338 end
wolffd@0 339 if isnan(option.tension)
wolffd@0 340 option.tension = 1;
wolffd@0 341 end
wolffd@0 342 if isnan(option.concepts)
wolffd@0 343 option.concepts = 1;
wolffd@0 344 end
wolffd@0 345 if option.concepts
wolffd@0 346 option.happy = 1;
wolffd@0 347 option.sad = 1;
wolffd@0 348 option.tender = 1;
wolffd@0 349 option.anger = 1;
wolffd@0 350 option.fear = 1;
wolffd@0 351 end
wolffd@0 352 if option.happy==1 || option.sad==1 || option.tender==1 ...
wolffd@0 353 || option.anger==1 || option.fear==1
wolffd@0 354 if isnan(option.happy)
wolffd@0 355 option.happy = 0;
wolffd@0 356 end
wolffd@0 357 if isnan(option.sad)
wolffd@0 358 option.sad = 0;
wolffd@0 359 end
wolffd@0 360 if isnan(option.tender)
wolffd@0 361 option.tender = 0;
wolffd@0 362 end
wolffd@0 363 if isnan(option.anger)
wolffd@0 364 option.anger = 0;
wolffd@0 365 end
wolffd@0 366 if isnan(option.fear)
wolffd@0 367 option.fear = 0;
wolffd@0 368 end
wolffd@0 369 end
wolffd@0 370
wolffd@0 371
wolffd@0 372 %%
wolffd@0 373 function e = initialise(rm)
wolffd@0 374 e = [];
wolffd@0 375
wolffd@0 376
wolffd@0 377 function e = activity(e,rm,fpv,sc,ss,se) % without the box-cox transformation, revised coefficients
wolffd@0 378 af = zeros(5,1);
wolffd@0 379 af(1) = 0.6664* ((mean(rm) - 0.0559)/0.0337); %
wolffd@0 380 af(2) = 0.6099 * ((mean(fpv{1}) - 13270.1836)/10790.655);
wolffd@0 381 af(3) = 0.4486*((mean(cell2mat(sc)) - 1677.7)./570.34);
wolffd@0 382 af(4) = -0.4639*((mean(cell2mat(ss)) - 250.5574)./205.3147);
wolffd@0 383 af(5) = 0.7056*((mean(se) - 0.954)./0.0258);
wolffd@0 384 af(isnan(af)) = [];
wolffd@0 385 e(end+1,:) = sum(af)+5.4861;
wolffd@0 386 e = {e af};
wolffd@0 387
wolffd@0 388 function e = valence(e,rm,fpv,kc,mo,ns) % without the box-cox transformation, revised coefficients
wolffd@0 389 vf = zeros(5,1);
wolffd@0 390 vf(1) = -0.3161 * ((std(rm) - 0.024254)./0.015667);
wolffd@0 391 vf(2) = 0.6099 * ((mean(fpv{1}) - 13270.1836)/10790.655);
wolffd@0 392 vf(3) = 0.8802 * ((mean(kc) - 0.5123)./0.091953);
wolffd@0 393 vf(4) = 0.4565 * ((mean(mo) - -0.0019958)./0.048664);
wolffd@0 394 ns(isnan(ns)) = [];
wolffd@0 395 vf(5) = 0.4015 * ((mean(ns) - 131.9503)./47.6463);
wolffd@0 396 vf(isnan(vf)) = [];
wolffd@0 397 e(end+1,:) = sum(vf)+5.2749;
wolffd@0 398 e = {e vf};
wolffd@0 399
wolffd@0 400 function e = tension(e,rm,fpv,kc,hc,nr)
wolffd@0 401 tf = zeros(5,1);
wolffd@0 402 tf(1) = 0.5382 * ((std(rm) - 0.024254)./0.015667);
wolffd@0 403 tf(2) = -0.5406 * ((mean(fpv{1}) - 13270.1836)/10790.655);
wolffd@0 404 tf(3) = -0.6808 * ((mean(kc) - 0.5124)./0.092);
wolffd@0 405 tf(4) = 0.8629 * ((mean(hc) - 0.2962)./0.0459);
wolffd@0 406 tf(5) = -0.5958 * ((mean(nr) - 71.8426)./46.9246);
wolffd@0 407 tf(isnan(tf)) = [];
wolffd@0 408 e(end+1,:) = sum(tf)+5.4679;
wolffd@0 409 e = {e tf};
wolffd@0 410
wolffd@0 411
wolffd@0 412 % BASIC EMOTION PREDICTORS
wolffd@0 413
wolffd@0 414 function e = happy(e,fpv,ss,cp,kc,mo)
wolffd@0 415 ha_f = zeros(5,1);
wolffd@0 416 ha_f(1) = 0.7438*((mean(cell2mat(fpv)) - 13270.1836)./10790.655);
wolffd@0 417 ha_f(2) = -0.3965*((mean(cell2mat(ss)) - 250.5574)./205.3147);
wolffd@0 418 ha_f(3) = 0.4047*((std(cell2mat(cp)) - 8.5321)./2.5899);
wolffd@0 419 ha_f(4) = 0.7780*((mean(kc) - 0.5124)./0.092);
wolffd@0 420 ha_f(5) = 0.6220*((mean(mo) - -0.002)./0.0487);
wolffd@0 421 ha_f(isnan(ha_f)) = [];
wolffd@0 422 e(end+1,:) = sum(ha_f)+2.6166;
wolffd@0 423 e = {e ha_f};
wolffd@0 424
wolffd@0 425 function e = sad(e,ss,cp,mo,hc,nt)
wolffd@0 426 sa_f = zeros(5,1);
wolffd@0 427 sa_f(1) = 0.4324*((mean(cell2mat(ss)) - 250.5574)./205.3147);
wolffd@0 428 sa_f(2) = -0.3137*((std(cell2mat(cp)) - 8.5321)./2.5899);
wolffd@0 429 sa_f(3) = -0.5201*((mean(mo) - -0.0020)./0.0487);
wolffd@0 430 sa_f(4) = -0.6017*((mean(hc) - 0.2962)./0.0459);
wolffd@0 431 sa_f(5) = 0.4493*((mean(nt) - 42.2022)./36.7782);
wolffd@0 432 sa_f(isnan(sa_f)) = [];
wolffd@0 433 e(end+1,:) = sum(sa_f)+2.9756;
wolffd@0 434 e = {e sa_f};
wolffd@0 435
wolffd@0 436 function e = tender(e,sc,rg,kc,hc,ns)
wolffd@0 437 te_f = zeros(5,1);
wolffd@0 438 te_f(1) = -0.2709*((mean(cell2mat(sc)) - 1677.7106)./570.3432);
wolffd@0 439 te_f(2) = -0.4904*((std(rg) - 85.9387)./106.0767);
wolffd@0 440 te_f(3) = 0.5192*((mean(kc) - 0.5124)./0.0920);
wolffd@0 441 te_f(4) = -0.3995*((mean(hc) - 0.2962)./0.0459);
wolffd@0 442 te_f(5) = 0.3391*((mean(ns) - 131.9503)./47.6463);
wolffd@0 443 te_f(isnan(te_f)) = [];
wolffd@0 444 e(end+1,:) = sum(te_f)+2.9756;
wolffd@0 445 e = {e te_f};
wolffd@0 446
wolffd@0 447 function e = anger(e,rg,kc,se,nr) %
wolffd@0 448 an_f = zeros(5,1);
wolffd@0 449 %an_f(1) = -0.2353*((mean(pc) - 0.1462)./.1113);
wolffd@0 450 an_f(2) = 0.5517*((mean(rg) - 85.9387)./106.0767);
wolffd@0 451 an_f(3) = -.5802*((mean(kc) - 0.5124)./0.092);
wolffd@0 452 an_f(4) = .2821*((mean(se) - 0.954)./0.0258);
wolffd@0 453 an_f(5) = -.2971*((mean(nr) - 71.8426)./46.9246);
wolffd@0 454 an_f(isnan(an_f)) = [];
wolffd@0 455 e(end+1,:) = sum(an_f)+1.9767;
wolffd@0 456 e = {e an_f};
wolffd@0 457
wolffd@0 458 function e = fear(e,rm,at,fpv,kc,mo)
wolffd@0 459 fe_f = zeros(5,1);
wolffd@0 460 fe_f(1) = 0.4069*((std(rm) - 0.0243)./0.0157);
wolffd@0 461 fe_f(2) = -0.6388*((mean(at) - 0.0707)./0.015689218536423);
wolffd@0 462 fe_f(3) = -0.2538*((mean(cell2mat(fpv)) - 13270.1836)./10790.655);
wolffd@0 463 fe_f(4) = -0.9860*((mean(kc) - 0.5124)./0.0920);
wolffd@0 464 fe_f(5) = -0.3144*((mean(mo) - -0.0019958)./0.048663550639094);
wolffd@0 465 fe_f(isnan(fe_f)) = [];
wolffd@0 466 e(end+1,:) = sum(fe_f)+2.7847;
wolffd@0 467 e = {e fe_f};
wolffd@0 468
wolffd@0 469 function fp = noframe(fp)
wolffd@0 470 fp = [fp(1);fp(end)];