Percentage change in the Y axix for unit change in X axis
2 次查看(过去 30 天)
显示 更早的评论
If I have a 2D plot, how can I calculate the percentage change in the Y axix for unit change in X axis?
0 个评论
回答(1 个)
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 %')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fit Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!