Shifting graph vertically upwards
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Image Analyst
el 21 de Feb. de 2015
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.
Respuestas (1)
Image Analyst
el 21 de Feb. de 2015
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);
0 comentarios
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!