using limit in differentiation

4 visualizzazioni (ultimi 30 giorni)
mukesh bisht
mukesh bisht il 5 Dic 2021
Commentato: Dyuman Joshi il 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 Commento
Dyuman Joshi
Dyuman Joshi il 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])

Accedi per commentare.

Risposte (1)

Saurabh
Saurabh il 15 Feb 2024
Modificato: Saurabh il 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!!

Community Treasure Hunt

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

Start Hunting!

Translated by