# Integration when some of the values change over time

조회 수: 5 (최근 30일)
L'O.G. . 2023년 5월 11일
댓글: Torsten . 2023년 5월 11일
I have a function of the form where is the position of the k-th object and is the corresponding force. The force has a functional that is also dependent on . I want to integrate this with respect to time and output the value for each time point. I think the values and would therefore change as a function of time. How do I do this which I imagine would need to be done recursively?
##### 댓글 수: 1표시 없음숨기기 없음
Torsten 2023년 5월 11일
How do you determine xk ? x can be considered as a constant during time integration ?

댓글을 달려면 로그인하십시오.

### 답변 (1개)

Sulaymon Eshkabilov 2023년 5월 11일
Simply write a code, e.g.:
t=linspace(0, 5, 200);
F = 5*cos(2*pi*t);
xk = 2*sin(2*pi*5*t);
x = linspace(0,25);
for ii = 1:numel(x)
y(ii) = sum((F.*(x(ii)-xk))/norm(x(ii)-xk));
end
subplot(211)
plot(xk, F)
xlabel('x_k')
ylabel('F_k')
grid on
subplot(212)
plot(x, y)
xlabel('x')
ylabel('y')
grid on ##### 댓글 수: 3표시 이전 댓글 수: 2숨기기 이전 댓글 수: 2
L'O.G. 2023년 5월 11일
y(x) is defined via a sum. As I mentioned in my post, I want to integrate over that. The confusion for me is to do so while updating the values of x_k (and hence y(x) and F_k).

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

R2021b

### Community Treasure Hunt

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

Start Hunting!