using limit in differentiation

3 次查看(过去 30 天)
mukesh bisht
mukesh bisht 2021-12-5
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 个评论
Dyuman Joshi
Dyuman Joshi 2024-2-15
"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
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!!

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by