MATLAB: Regression with some part of the array regression Suppose I have x vector=[ 1 5 6 7 8 3 2 ] and corresponding y vector [2 9 4 6 4 5 6]. How to run regression for y on x for x>3. Thanks. Best Answer x = [ 1 5 6 7 8 3 2 ];y = [ 2 9 4 6 4 5 6 ];idx = find(x > 3); % Returns the indexes where x is larger than 3plotregression(x(idx), y(idx)); % Only uses the indexes of the vectors, where x were larger than 3Replace with other regression methods, depending on what you need. Related SolutionsMATLAB: Place matrix in array part 2 Well ify = [ones(3,1); -ones(3,1)]% ory = [1; 1; 1; -1; -1; -1];and x is taken from your previous question, then your result would be.res = y * y' .* x * x';This is very basic matrix multiplication. I suggest you read through some tutorials MATLAB: Plotting a specific part of the array idy1=y1(y1~=y2)idy2=y2(y2~=y1)Results: idy1 = 6 7 8 9 8 7 7 6idy2 = 4 3 2 1 1 2 3 4 Note: x1 having length 14, whereas y1 and y2 having length 15, Now x1 comparision with? Related QuestionRemove a part form a vectorSort a specific part of a rowMean command gives wrong answerHow to hide a part of the functionFinding indices when vectors is used
Best Answer