Info

This question is closed. Reopen it to edit or answer.

Interpolation based on data points

1 view (last 30 days)
Tigist Beyene
Tigist Beyene on 23 Feb 2019
Closed: MATLAB Answer Bot on 20 Aug 2021
I wanted to do the derivative of the density based on the data below . My code returns only the
last value. I don't know why. Besdies I am not sure wether I have done it correctly. Thanks for the help.
function [rho, N]=density(z)
zval= [2 3 5 7 10 15 20 25];
rho1 = [17.2731684 17.1649375 21.43455647 22.4140625 23.86332207 24.3746967 24.70487685 24.6003125];
zvala=400-zval;
zvalue=fliplr(zvala);
rho2=fliplr(rho1);
rho3=smoothdata(rho2,'lowess',6);
rho=interp1(zvalue,rho3,z);
rho4=interp1(zvalue,rho3,z+0.1);
N=rho4-rho % drho /dz
end

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!