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

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