using limit in differentiation

3 views (last 30 days)
mukesh bisht
mukesh bisht on 5 Dec 2021
Commented: Dyuman Joshi on 15 Feb 2024
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 Comment
Dyuman Joshi
Dyuman Joshi on 15 Feb 2024
"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])

Sign in to comment.

Answers (1)

Saurabh
Saurabh on 15 Feb 2024
Edited: Saurabh on 15 Feb 2024
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!!

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!