I am trying to plot a 2×2 contour subplot, it is supposed to be circular, but I either get lines or no plot at all or an error saying my z needs to be a 2×2 array.
function F = ratio_rp_bf(R,theta,bD)for r = 1:length(R) for b = 1:length(bD) F(b,r) = (16/3).*(1./bD(b)).*(1./R(r)).^3.*abs(sqrt((1./R(r)).^4-2.*(1./R(r)).^2.*cos(2.*theta(r))+1)); endendbD = [0.1, 1.0, 10, 100];R = (1:1.25:5);c = R;a = 1/2*bD;b = abs(sqrt(c.^2 - a.^2));theta = abs(atan(b./a));[F] = ratio_rp_bf(R,theta,bD); for b = 1:length(bD) figure(1) subplot(2,2,b) x = R.*cos(theta); y = R.*sin(theta); z = F; [x,y,z] = meshgrid(x,y,z); [C,h] = contour(R,theta,bD,x,y,z); clabel(C,h); grid on end
Best Answer