How to print the intersection between two functions?
Show older comments
Here is my code:
% Projectile motion
z0=0;h0=0; tmax=3; t=[0:0.1:1]*tmax;
pr_xdot = @(t,x) ([x(2); -9.81; x(4); 0]);
[tt,zz]=ode45(pr_xdot,t,[z0; v0z; h0; v0h]);
% Distance BC
x=0:0.1:15; y=x*tand(-beta);
plot(zz(:,3), zz(:,1), x, y); grid on; legend ('Projectile','Inclination');
xlabel('Horizontal distance [m]'); y1=ylabel('Vertical distance [m]');
interp1(x,y,pr_xdot)
I'm trying to use interp1 to find the value where the differential equation intersections with the simple x,y linear plot. I then want to print the resulting x and y coordinate. But I'm not having any luck with my interp1 function

Answers (1)
darova
on 12 Apr 2019
zz1=interp1(zz(:,3),zz(:,1),x); % if you want to interpolate projectile


More points - better precisionCategories
Find more on Interpolation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!