I have a matrix which is 100x1
in size. I wish to input each row value of my matrix into a function iteratively. For example, say L1
represents row 1 of my matrix L
, L2
row 2, and so on. Say my function which I seek to input each value of L
into is denoted Y
. Therefore I seek to input L1
into Y
to Produce Y1
, L2
for Y2
and so on.
I could really do with help on how to implement this in matlab?
accept Code is as follows:
load('logregdata.mat')
%%Data set X is a series of coordinates in two dimensions and t represents class labels. Data set is for a binary classification problem.
u = rand;
[w1,w2] = meshgrid(-5:0.1:5,-5:0.1:5);
w = zeros(2,1);
w_all = zeros(100,2);
%Probabilistic term of logistic classifier prob_t = 1./(1+exp(-[w1(:) w2(:)]*X'));
L = sum(log(prob_t).*repmat(t',numel(w1),1),2);
L= L + sum (log(1-prob_t).*repmat(1-t',numel(w1),1),2);
u = rand;
y = log(L/u);
Thanks for all your help in advance.
u
the same for each row ofL
? – beaker