MATLAB: How can I plotting one over other plot hi all the attached figure is contains of 2 curves, those are which I want to plot them over each other by using statistical way (mean) how should I do that? thank you in advance. Best Answer all_x = unique([blue_x, red_x]);in_common_range = min(blue_x) <= all_x & all_x <= max(blue_x) & min(red_x) <= all_x & all_x <= max(red_x);common_x = all_x(in_common_range);blue_projected = interp1(blue_x, blue_y, common_x);red_projected = interp1(red_x, red_y, common_x);mean_x = (blue_projected + red_projected)./2;plot(common_x, mean_x, 'g') Related SolutionsMATLAB: How to save variables and put them in a vector Example:num_runs = 10;all_x = zeros(num_runs, 1);all_y = zeros(num_runs, 1);for K = 1 : num_runs x = randi([-K K], 1, 1); y = x.^2; all_x(K) = x; all_y(K) = y;end MATLAB: How to find a point within a curve Try this:% Extract the curve for X (Volume)x = Array_demand{w}.Volume;% Extract the curve for Y (Price)y = Array_demand{w}.Price;% Define blue xbluex = 43210;% Define red xredx = bluex - 500% Find index of the red xredIndex = find(x <= redx, 1, 'last');% Get the y value thereredy = y(redIndex) Related QuestionHow to plot in red colour on image
Best Answer