Percentage change in the Y axix for unit change in X axis

6 Ansichten (letzte 30 Tage)
Joydeb Saha
Joydeb Saha am 20 Jul. 2021
Beantwortet: Jonas am 20 Jul. 2021
If I have a 2D plot, how can I calculate the percentage change in the Y axix for unit change in X axis?

Antworten (1)

Jonas
Jonas am 20 Jul. 2021
if you have y data along x you can calculate diff(y)./diff(x) to get the derivate. to get the pointswise percentage value divide additionally by y(1:end-1). FInally mutiply by 100 to get percentage values
x=201:300; y=1:100;
plot(x(2:end),diff(y)./diff(x)./y(1:end-1)*100);
ylabel('change in %')

Kategorien

Mehr zu Descriptive Statistics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by