viewing paste Unknown #35031 | Matlab M

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
function [x,y] = GetLine(weights, weightsSupervised, bias, startX, endX, k)
  x = startX:0.001:endX;
  y = zeros(1, length(x));
  yStart = 0;
  input = GetG(weights, [startX yStart],k);
  startValue =  RunNetwork(input, weightsSupervised, bias);
  hasSwitched = false;
  for i = 1:length(x)
    while ~hasSwitched
      if startValue < 0
        yStart = yStart + 0.001;
        input = GetG(weights, [x(i), yStart],k);
        output = RunNetwork(input, weightsSupervised, bias);
        if sign(output) ~= sign(startValue)
          hasSwitched = true;
        end
      else
        yStart = yStart - 0.01;
        input = GetG(weights, [x(i), yStart],k);
        output = RunNetwork(input, weightsSupervised, bias);
        if sign(output) ~= sign(startValue)
          hasSwitched = true;
        end
      end
    end
    y(i) = yStart;
    hasSwitched = false;
    startValue = output;
  end
  
end
Viewed 862 times, submitted by Guest.