How to plot a derivative against variable?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
River
el 1 de Abr. de 2023
Respondida: Peter Perkins
el 5 de Abr. de 2023
Use if statements to select an equation for x based on the inputed value for damping. Plot a graph of x (displacement) against time (this bit works). Then want to differentiate x for velocity, and differentiate velocity for acceleration and then plot all three. I used:
syms t
v = diff(x,1)
plot(t,v)
Get error "Data must be numeric, datetime, duration, categorical, or an array convertible to double."
x is a previously selected equation with t as a variable, also includes Z but this is asked for and inputted at the beginning.
2 comentarios
Respuesta aceptada
Walter Roberson
el 1 de Abr. de 2023
Change
t = (0.0:0.001:5);
to
syms t
Change
plot(t,x,'b')
to
fplot(x, [0 5])
change
plot(t, v)
to
fplot(v, [0 5])
Más respuestas (1)
Peter Perkins
el 5 de Abr. de 2023
For extra credit, create a timetable from displacement, add velocity and accel, then use stackedplot to plot all three together.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!