how to draw a tangent to a data points at a given x-coordinates in matlab
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jagadeesh Korukonda
le 22 Sep 2020
Réponse apportée : Ameer Hamza
le 22 Sep 2020
Suppose I've a data like this
t=0:10:100 Ca = 50,26.1,13.6266,7.11,3.7137,1.9387,1.012, .5284, .2758, .1440, .0752
This is some experimental data of some rxn
Here I want to know the slope of tangent at some x value.
So how we draw the tangents to this data points using matlab
0 commentaires
Réponse acceptée
Ameer Hamza
le 22 Sep 2020
Unless you have an equation describing these data points, you can only estimate the slope of tangent (derivative) using gradient() function and then interpolating the result.
For example
t = 0:10:100;
Ca = [50,26.1,13.6266,7.11,3.7137,1.9387,1.012, .5284, .2758, .1440, .0752];
dCa_dt = gradient(Ca)./gradient(t);
df = @(t_) interp1(t, dCa_dt, t_); % derivarive of Ca at any point t=t_
Result
>> df(2)
ans =
-2.2757
>> df(45)
ans =
-0.1968
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interpolation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!