How do I plot input equations from the user?
Afficher commentaires plus anciens
Please help. I would like to plot equations with the equation itself (e.g. x + y ==5)as user input. Also, how do I find the coordinates of the point of intersection. Please tell me where am I making a mistake.
n = input ('Enter number of equations: ');
syms x y
for j=1:n
equ(j)= string(input ('Enter equations: ','s') );
end
for j=1:n
func(j) = evalin(symengine, equ(j));
end
for j=1:n
fplot(func(j));
end
Réponses (1)
KSSV
le 18 Sep 2017
% plot tow straight lines
L1 = [0.4018 0.2399 ; 0.0760 0.1233 ] ;
L2 = [0.1839 0.4173; 0.2400 0.0497] ;
% plot
figure
hold on
plot(L1(1,:),L1(2,:),'r') ;
plot(L2(1,:),L2(2,:),'b') ;
% Intersection point
P = InterX(L1,L2) ;
plot(P(1),P(2),'*k')
Download InterX function which gives you intersection from this link: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?focused=5165138&tab=function
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!