1

So sorry to ask this naive question, but I really get stuck as an absolute MATLAB newbie.

Below is what I am trying to do. I have a model that takes coin flip outcomes as its input:

function randomness = benHMMN(flips,rep,prior) % defined later
flips = csvread('flips.csv')

On the right-hand side, "flips" are coin flipping outcomes read from a file, while "rep" and "prior" are two parameters whose values I am trying to find. The function outputs randomness evaluation for all coin flips, which is a column vector with 256 elements.

csvread('judgement.csv')

Meanwhile, I had humans evaluate the same set of outcomes and their responses are stored in another column vector with 256 elements. (Note that humans judge how non-random instead of how random these outcomes are.)

I wish to minimize the correlation between two vectors.

corr(randomness, judgment)

On an abstract level, I guess the solution looks something like this:

function correlation = corr(randomness, judgment)
[...,fval] = fminsearch(@corr, ...)

However, the arguments are NOT directly the parameters ('rep' and 'prior') that I want to fit, but a function with them in it. I have no idea how to use fminsearch or other methods to find 'rep' and 'prior' when they are not explicitly in the arguments. I would really appreciate your help!

ramund
  • 185
  • 11
  • 1
    Sorry, I don't understand why something like `foo = @(X) corr(benHMMN(flips,X(1),X(2)),judgement)` and then `fminsearch(foo,[0 0])` wouldn't work – Noel Segura Meraz Jan 26 '17 at 07:04
  • Thanks for your answer! I tried this method, but MATLAB returns an error: fv(:,1) = funfcn(x,varargin{:}) – ramund Jan 26 '17 at 21:48
  • Please add the full output of the error. Also please check that the auxiliary function ‘foo ‘ returns only one scalar number – Noel Segura Meraz Jan 27 '17 at 01:42
  • I closed all the windows and tried again. Then it worked! Sorry I do not have the full error message anymore. Thank you for your help again! – ramund Jan 30 '17 at 00:27

0 Answers0