How to do differentiation in Matlab

1 次查看(过去 30 天)
clc;
clear;
THT = 0:12:360;
L_spm = [67.14387343 67.08087868 71.27139857 77.8011002 83.48598354 86.53313448 86.96218524 86.54264509 86.55222711 86.96002063 86.43128473 83.48041917 77.77271123 71.24225453 67.07111986 67.25745156 67.08157624 71.23009025 77.76475253 83.46615144 86.42639244 86.96777069 86.54247287 86.56340306 86.9412182 86.52945688 83.49766473 77.78259172 71.25635182 67.06788196 67.14602485];
How to differentiate L_spm with respect to THT? Thanks.

采纳的回答

James Tursa
James Tursa 2024-5-28
编辑:James Tursa 2024-5-28
Are you just asking for piecewise linear differencing for derivative calculations between the points? E.g.,
THT = 0:12:360;
L_spm = [67.14387343 67.08087868 71.27139857 77.8011002 83.48598354 86.53313448 86.96218524 86.54264509 86.55222711 86.96002063 86.43128473 83.48041917 77.77271123 71.24225453 67.07111986 67.25745156 67.08157624 71.23009025 77.76475253 83.46615144 86.42639244 86.96777069 86.54247287 86.56340306 86.9412182 86.52945688 83.49766473 77.78259172 71.25635182 67.06788196 67.14602485];
d = diff(L_spm) ./ diff(THT)
d = 1x30
-0.0052 0.3492 0.5441 0.4737 0.2539 0.0358 -0.0350 0.0008 0.0340 -0.0441 -0.2459 -0.4756 -0.5442 -0.3476 0.0155 -0.0147 0.3457 0.5446 0.4751 0.2467 0.0451 -0.0354 0.0017 0.0315 -0.0343 -0.2526 -0.4763 -0.5439 -0.3490 0.0065
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Or are you asking how to curve fit and calculate derivatives from the curve?
  2 个评论
Anurag Sharma
Anurag Sharma 2024-5-29
编辑:Anurag Sharma 2024-5-29
Thanks for your response & helping me with the differentiation. How do I plot d = diff(L_spm) ./ diff(THT).
When I am plotting 'd' with resepct to 'THT' using "plot(THT,d)". It gives me following error "Error using plot Vectors must be the same length"
Torsten
Torsten 2024-5-29
编辑:Torsten 2024-5-29
THT = 0:12:360;
L_spm = [67.14387343 67.08087868 71.27139857 77.8011002 83.48598354 86.53313448 86.96218524 86.54264509 86.55222711 86.96002063 86.43128473 83.48041917 77.77271123 71.24225453 67.07111986 67.25745156 67.08157624 71.23009025 77.76475253 83.46615144 86.42639244 86.96777069 86.54247287 86.56340306 86.9412182 86.52945688 83.49766473 77.78259172 71.25635182 67.06788196 67.14602485];
d = gradient(L_spm)./gradient(THT);
plot(THT,d)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by