how to find the amplitude?

Hello
Im writing a code for calculating blood pressure. My problem is i don't know how to solve this. I think it will be a lot easier if i knew how to "rotate" my graph(there is a picture attached). My data is number 1 in the picture. I would like to have it as no. 2.
I hope one of your guys can help me.
In advance thanks :)

 Accepted Answer

How about you fit a line or quadratic to your data with polyfit(). Then subtract it from the signal to get the residuals. Then subtract the min of the residuals and plot it.
x = 1 : length(y);
polynomialOrder = 1; % for line, or 2 for quadratic.
coefficients = polyfit(x, y, polynomialOrder);
% Get fitted line
fittedLine = polyval(coefficients, x);
% Get delta y between fitted line and actual data.
r = y - fittedLine;
% That r will have positive and negative elements.
% Raise the curve by subtracting the min
% so that there will be only positive values.
new_y = r - min(r);
plot(x, new_y, 'r-', 'LineWidth', 2);
grid on;
fontSize = 20; % whatever size you want.
xlabel('Time', 'FontSize', fontSize);
ylabel('Blood Pressure', 'FontSize', fontSize);

More Answers (0)

Categories

Find more on Chemistry in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!