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

2 ビュー (過去 30 日間)
Joydeb Saha
Joydeb Saha 2021 年 7 月 20 日
回答済み: Jonas 2021 年 7 月 20 日
If I have a 2D plot, how can I calculate the percentage change in the Y axix for unit change in X axis?

回答 (1 件)

Jonas
Jonas 2021 年 7 月 20 日
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 %')

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by