Creating a plotting Threshold across multiple variables

2 次查看(过去 30 天)
Hello again!
Today I am trying to add a second layer to an exisiting plot by using a threshold for when the distance from the median deviates +/- 5 mm. I am not sure using logical operators is helpful or just confusing me more.
I have attached my code below. The issue I am having is retaining the original matrix column and carrying the values over into a new matrix when I get a logical 1. I cannot figure out how to turn my logical array back into a matrix with the appropriate/orignal numbers in the correct placement with respect to the original matrix column.
I apologize if my description is confusing. I will be actively viewing if any one has any questions. I feel like I am on the right idea but still not sure if this actually makes sense from a programming stand point.
Thank you for your time and help.
%% 3) Adding multiple lines to a plot
% - Color the part of the line from the previous plot where the CoP deviates more than 5mm away from
% the center on the x axis or more than 5mm away from the center on the y axis in red.
% Do this by plotting a second line on top of the line from question number 2.
Mx = median(COPD_data.AnteriorPosteriorSway_mm_) %median(Sortx)
My = median(COPD_data.MedioLateralSway_mm_) %median(Sorty)
Basex_plus = Mx+5 %mm
Basex_minus = Mx-5
Basey_plus = My+5 %mm
Basey_minus = My-5
Adjust_AP = (COPD_data.AnteriorPosteriorSway_mm_ >= Basex_minus &...
COPD_data.AnteriorPosteriorSway_mm_ >= Basex_plus)
Adjust_ML = (COPD_data.MedioLateralSway_mm_>= Basey_minus &...
COPD_data.MedioLateralSway_mm_>= Basey_plus)
%Dev_AP(Adjust_AP)
plot (Adjust_AP, Adjust_ML, 'r--')
hold off

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by