Differentiation help with polynomial

Here is what I have so far im not sure if it is entirely correct but im having trouble comparing the data to see how close they come to each other
yest=[1147 777 479 253 99 17 7 69 203 409 687];%estimated y values using slopes between points
y=polyval(polyder([12 -5 0 3]),[-5:5]);
x=[-5:5];
figure(1);
subplot(1,2,1);
bar(x,y)
title('Y Calculated')
subplot(1,2,2)
bar(x,yest)
title('Y Estimated')

回答(1 个)

Since ‘y’ and ‘yest’ have the same number of elements, I would just subtract them (assuming they are with respect to the same (‘x’ values).
Two possibilities:
dydx_dif = y - yest; % Absolute Difference
dydx_dif = (y - yest)./y; % Relative Difference
Others certainly exist, such as the squares of the differences, the square root of the squares of the differences, and aggregate statistics based on those calculations, such as root-mean-square error for all of them.

此问题已关闭。

产品

版本

R2019a

提问:

2019-4-3

关闭:

2021-8-20

Community Treasure Hunt

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

Start Hunting!

Translated by