How to print the intersection between two functions?
Afficher commentaires plus anciens
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

Réponses (1)
darova
le 12 Avr 2019
zz1=interp1(zz(:,3),zz(:,1),x); % if you want to interpolate projectile


More points - better precisionCatégories
En savoir plus sur Interpolation dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!