Align multiple graphs in a plot
이전 댓글 표시
Hi,
In my GUI I plot multiple graphs in one figure from a matrix (p_matrix) using a for loop. I need to align all the graphs (there are 52 of them) with one maximum point as the reference point, i.e. if I take the index of the maximum of the middle row of my matrix all the other rows maximum points should be at the same index. In some way I need to write a function that takes away some values from either the end or the beginning of the row depending on the maximum point of the row being at a lower or higher index respectively. I have tried with this attempt:
function [p_lined_graphs] = lineGraphs(p_matrix, y_matrix)
%Function to line up the graphs in order to take a mean value of them later
%and reducing the noise
p_lined_graphs = zeros(52,120);
for n=1:52
vector = p_matrix(n,:);
[maxValueN indexAtMaxN] = max(vector);
for m=10:110
if indexAtMaxN ~= indexAtMax
diffIndex = indexAtMax - indexAtMaxN;
p_lined_graphs(n,m) = p_matrix(n,abs(m-diffIndex));
elseif indexAtMaxN == indexAtMax
p_lined_graphs(n,m) = p_matrix(n,m);
end
end
end
, and then I plot the p_lined_graphs in my GUI code but the graphs aren't aligned... Is there anyone that might know what I have done wrong or have another simpler way of aligning the graphs?
Thanks in advance!
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Networks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!