I have the below function:
function [x,y] = cardioid2(bs,s)
if nargin == 0
x = 4;
return
end
if nargin == 1
dl = [ 0 pi/2 pi 3*pi/2
pi/2 pi 3*pi/2 2*pi
1 1 2 2
0 0 0 0];
dl = [dl];
x = dl(:,bs);
return
end
x = zeros(size(s));
y = zeros(size(s));
if numel(bs) == 1
bs = bs*ones(size(s));
end
cbs = find(bs < 3);
x(cbs) = (4+0.1*cos(s(cbs))).*cos(s(cbs));
y(cbs) = (4+0.1*cos(s(cbs))).*sin(s(cbs));
cbs = find(bs >= 3 & bs <= 4);
x(cbs) = 4*cos(s(cbs));
y(cbs) = 0;
save('my_parameters.mat')
end
By running code:
pdegplot('cardioid2','EdgeLabels','on')
A semicircle with radius of 4 will be generated.
I do not know how would it be possible to to modify the code in a way I can have the radius vary proportional to polar angle (let's say r=1+0.2cos(teta)) where teta is from 0 to pi.
Please if you cannot help at least do not vote down, it will pose me to being blocked.