Borrar filtros
Borrar filtros

Derivative of vector wrt time vector

33 visualizaciones (últimos 30 días)
Jerry
Jerry el 8 de Ag. de 2012
Comentada: Rusty el 17 de En. de 2015
if i have a vector x=[0 6 7 7.....] and this x is measure with respect to a time vector then how can we find the derivative like dx/dt like the simulink block has the drivative, which computes with respect to simulation time but what can be done i case of MATLAB how this time vector can be differentiated with the x vector becasue both contain values. Any idea will be appreciated.
  1 comentario
Rusty
Rusty el 17 de En. de 2015
Hi, I have made a program for you. Do you want the answer?

Iniciar sesión para comentar.

Respuesta aceptada

Kevin Claytor
Kevin Claytor el 8 de Ag. de 2012
A simple brute force numerical derivative would be find the change in x and divide by the change in t;
dx = x(2:end) - x(1:end-1);
dt = t(2:end) - t(1:end-1);
v = dx./dt
  5 comentarios
Jerry
Jerry el 12 de Ag. de 2012
diff gives the same output but my problem is my length is decreasing, I must agree with Greg here but how can we have a way that after applying diff or gradient the size remains same to the original vector since due to diff it become n-1 ,by mean of interpolation or what how shud v keep it to the original size? I have posted another question for this I hope you can help me on this since i developed the whole code myself by taking constant help from you guys.
Jerry
Jerry el 12 de Ag. de 2012
Greg Thanks i think i got your point here... for initial and boundary conditions, ok can if i have an array
X=[ 0.1000 0.0844 0.0434 -0.0090 -0.0559 -0.0831 -0.0832 -0.0574 -0.0152 0.029] Which shows the position and time array with respect to that position is T= [0 0.5000 1.0000 1.5000 2.0000 2.5000 3.0000 3.5000 4.0000 4.5000]
can i like take time 0 as initial value and the last value as boundary condition.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by