Hi,
I am calculating differentiation of a function v(t) wrt y which is also function of t i.e y(t) as follows:
syms t
x = 0.7071*t;
y = 0.7071*t - 4.9050*t^2;
v = 0.7071 - 9.81*t;
dv_dy = diff(v,t)/diff(y,t);
t = 0:0.001:1;
res = double(vpa(subs(dv_dy,{t}))); % result
The problem here is the differentiation approaches infinity when the denominator (diff(y,t)) of the term dv_dy approaches zero and it makes my result discontinuos (see fig). But it should be continous. How to correct it?

댓글 수: 1

"But it should be continous."
Why? Could you show the mathematics to back your claim?
syms t
y = 0.7071*t - 4.9050*t^2;
v = 0.7071 - 9.81*t;
dv_dy = diff(v,t)/diff(y,t)
dv_dy = 
limit(dv_dy, t, 7071/98100, 'left')
ans = 
limit(dv_dy, t, 7071/98100, 'right')
ans = 
fplot(dv_dy, [0 1])
ylim([-14e3 2e3])

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

답변 (1개)

Saurabh
Saurabh 2024년 2월 15일
편집: Saurabh 2024년 2월 15일

1 개 추천

Hi Mukesh,
I tried to reproduce the steps at my end and found out that the expression given by dv_dy will be discontinous at some point of time t, which is very close to 0.0721.
So, the possible work around solution which i can suggest is that you can exclude values of t which are very close to value 0.0721.
For reference I am attaching a code snippet:
syms t
x = 0.7071*t;
y = 0.7071*t - 4.9050*t^2;
v = 0.7071 - 9.81*t;
dv_dy = diff(v,t)/diff(y,t);
t = 0:0.001:1;
lower_bound = 0;
upper_bound = 0.1;
% Create a logical index that is true for values outside the range
index = ~(t >= lower_bound & t <= upper_bound);
% disp(size(t_values))
t = t(index);
% disp(size(t_values))
res = double(vpa(subs(dv_dy,{t}))); % result
plot(t, res);
This is the resultant graph I am getting after executing the code.
I hope this was helpful!!

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

질문:

2021년 12월 5일

댓글:

2024년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by