【问题标题】:How to do cumulative trapezoidal integration in MATLAB keeping the origin in the centre?如何在MATLAB中进行累积梯形积分,将原点保持在中心?
【发布时间】:2020-05-23 03:15:38
【问题描述】:

我有向量 top、bottom、mid 我试图整合 wrt i,将原点保持在索引 11。

i=0:0.01e-06:1.3e-06;
bottom=cumtrapz(i(11:end),b(11:end));
top=cumtrapz(i(11:end),t(11:end));
mid=cumtrapz(i(11:end),m(11:end));

bottom1=cumtrapz(i(1:11),b(1:11));
top1=cumtrapz(i(1:11),t(1:11));
mid1=cumtrapz(i(1:11),m(1:11));

figure(2)
plot([bottom1 bottom]);hold on
plot([top1 top])
plot([mid1 mid])

但是,情节看起来并不顺利,并且在原点处发生了不应该存在的突然变化。如何纠正它。

【问题讨论】:

  • 值重置,因为您正在开始一个新的积分...您所说的“将原点保持在索引 11”是什么意思? i 是什么?

标签: matlab integration


【解决方案1】:

计算两个单独的积分不是正确的方法。在计算积分后,可以根据需要通过移动 x 轴和 y 轴截距来调整原点。

i = 0:0.01e-06:1.3e-06;
t = rand(size(i));

top = cumtrapz(i,t);

plot(i-i(11), top-top(11))
xline(0)
yline(0)

【讨论】:

  • 谢谢。我绘制为 plot(i,top-top(11)) 以保留 i 值。
猜你喜欢
  • 1970-01-01
  • 2014-10-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-02
  • 2019-04-19
  • 2011-03-07
  • 2018-03-28
相关资源
最近更新 更多