i have writen this program to vary theta between 0 to 180 n phi btw to 360 in steps of 0.5..n store those values from loop n plot..but this takes a really long time to execute..how can i modify so that it executes faster.for j=10:5:3600for i=10:5:1800theta=(i/10)-1;phi=(j/10)-1;if (theta == 90)r=1;elser=(((sind(270*cosd(theta))).^2))/((3* (sind(90*cosd(theta)))).^2);endx(j,i)=r*cosd(phi)*sind(theta);y(j,i)=r*sind(phi)*sind(theta);z(j,i)=r*cosd(theta);endendplot3(x,y,z)
MATLAB: How can i modify this short program so that it executes faster
for loopoptimizationspeedvectorization
Best Answer