apsize= 0.182;apsize= apsize+0.000000001;Xspacing =.001;z = 0;k = -0.871; % conic constant
r = 0.066; % radius of curvature
a2= 0; a4= 120; a6=0 ; % coeff of higher order terms
c= 1/r;fid = fopen('sphere.NC','w');hold offfprintf(fid, 'G01\r\nG71\r\nG90\r\nG94\r\nG14\r\n' ); % g code header
fprintf(fid, 'T0101\r\n' ); % g code headerfprintf(fid, 'M4S4000\r\n' ); % g code headerfprintf(fid, 'M26\r\n' ); % g code headerwhile apsize >= 0.000000x2= apsize; z = -1*(((c*(x2.^2))./(1+sqrt(1-((1+k)*c*c*x2.^2))))+(a2*x2.^2)+(a4*x2.^4)+(a6*x2.^6));plot(x2,z,'red','LineWidth',2.4);hold on;(fprintf(fid, 'X%0.8f Z%0.8f \r\n', x2 , z )); apsize = apsize-Xspacing;endfprintf(fid, 'M29\r\n' ); % g code headerfprintf(fid, 'M5\r\n' ); % g code headerfprintf(fid, 'M30\r\n' ); % g code headerfprintf(fid, ' \r\n' ); % g code headerfclose(fid);
MATLAB: Hi I have a short code I wrote but the plot function does not show any data would someone take a look
MATLAB and Simulink Student Suiteploting
Best Answer