使用solve函数,解出方程的交点,使用plot函数标记,也可使用text标注
t = 0 : pi/100 : pi;
x1 = sin(3*t).*cos(t);
y1 = sin(3*t).*sin(t);
x2 = cos(t);
y2 = 2*x2-0.5;
plot(x1, y1, x2, y2); xlabel('x'); ylabel('y'); grid on; title('6');
hold on;
syms t x y
eqns = [x == sin(3*t)*cos(t), y == sin(3*t)*sin(t), y == 2*x - 0.5];
sol = solve(eqns, [t x y]);
t_sol = double(sol.t);
x_sol = double(sol.x);
y_sol = double(sol.y);
plot(x_sol, y_sol, 'r*');
hold off;
评论 (0)