How to print the intersection between two functions?
Mostrar comentarios más antiguos
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

Respuestas (1)
darova
el 12 de Abr. de 2019
zz1=interp1(zz(:,3),zz(:,1),x); % if you want to interpolate projectile


More points - better precisionCategorías
Más información sobre Interpolation en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!