Can I plot with a function?
Show older comments
I need to plot the velocity function versus time, but when I do, nothing shows up on the graph. Any ideas?
t = [0,0.52,1.04,1.75,2.37,3.25,3.83];
x = [153,185,208,249,261,271,273];
%plot approximate velocity over [0,3.83]
%part i, create x(t) then find derivative
i = interp1(x,t,0,'spline');
f = @(xx)interp1(t,x,xx,'spline');
velocity = derivf(f,0,0.0001); %88.2979
plot(velocity,[0 3.83],'g')
xlabel('time(s)')
ylabel('position(m)')
hold on
2 Comments
Walter Roberson
on 25 Mar 2021
What is the code for your derivf function? It does not appear to be a Mathworks function.
Anastasia Zistatsis
on 25 Mar 2021
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots 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!