How do I plot input equations from the user?
1 回表示 (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
KSSV
2017 年 9 月 18 日
% 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
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!