Shifting graph vertically upwards

I have a simple qn:
I want to shift a graph vertically upwards.
vert_offset = kneeV(1) - kneeangle(1);
peak_x = peak_x + horz_offset;
peak_y = peak_y + vert_offset;
kneeangle = [zeros(horz_offset,1); kneeangle];
kneeangle = kneeangle + vert_offset;
what i did was this, but my graph did not move upwards and only move sidewards. The graph only moved upwards when I plotted kneeangle+vert_offset instead of kneeangle.
Just for additional information, the kneeangle is a column array that is the y-value of my graph.

댓글 수: 3

Geoff Hayes
Geoff Hayes 2015년 2월 21일
Mich - what is the line of code that you are using to plot your data?
Image Analyst
Image Analyst 2015년 2월 21일
What is kneeangle supposed to be higher than? It looks like you just pushed it to the right by prepending a bunch of zeros to the top of the array.
Mich
Mich 2015년 2월 21일
편집: Mich 2015년 2월 21일
I'm comparing 2 sets of data, kneeV and kneeangle. Currently, the baseline value (initial value) for knee V is higher than kneeangle and greater in the x-direction too, so I would like to shift the graph for kneeangle to the right and of the same baseline as kneeV so that I can do a proper peak-to-peak comparison and obtain the error difference.
I've inserted an image of my graph obtained when I plot kneeangle+vert_offset
kneeangle- blue ,kneeV- black

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2015년 2월 21일

0 개 추천

Try this, aligning the means in the pulse train region:
% Crop the array
index = find(blueSignal > 1, 1, 'first');
% Get the mean
blueMean = mean(blueSignal(index:end));
% Now the same for the other black signal
% Crop the array
index = find(blackSignal > 1, 1, 'first');
% Get the mean
blackMean = mean(blackSignal (index:end));
% Subtract the blue mean and add the black mean to the blue signal
shiftedBueSignal = blueSignal - blueMean + blackMean;
plot(blackSignal);
hold on;
plot(shiftedBueSignal);

카테고리

도움말 센터File Exchange에서 Networks에 대해 자세히 알아보기

질문:

2015년 2월 21일

답변:

2015년 2월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by