matlab画极坐标图像

2025-01-20 16:34:26
推荐回答(1个)
回答1:

恐怕还是要解出来
clear,clc
%clf
f=@(p)@(x)[-sin(x(1))*cos(x(2))-0.6*sin(2*x(1))*cos(x(2))+0.9*...
sin(x(1)+x(2)+pi/3),cos(x(1))*cos(x(2))+0.38*cos(2*x(1))*cos(x(2))-...
0.9*cos(x(1)+x(2)+pi/3)-p];
op=optimset('display','off');
p=-3:.01:3;
n=length(p);
x=zeros(n,2);val=x;flag=x(:,1);
for i=1:n
[x(i,:),val(i,:),flag(i)]=fsolve(f(p(i)),rand(2,1),op);
end
d=[x(flag==1,2),(p(flag==1))'];
d(d(:,2)<0,1)=pi+d(d(:,2)<0,1);d(d(:,2)<0,2)=-d(d(:,2)<0,2);
d(:,1)=mod(d(:,1),2*pi);
d=sortrows(d);
polar(d(:,1),d(:,2))