How can I fix the alignment
Show older comments
The first 10 answers are vertically aligned in a way and the remaining values in another way. How can i fix that?
Here is the program:
nn=length(0:10:720);
P=zeros(nn,1);
V=zeros(nn,1);
x=zeros(nn,1);
alfa_cont=zeros(nn,1);
for alfa=0:10:720
cont=alfa/10+1;
cos_alfa=cosd(alfa);
alfa_cont(cont)=alfa;
x(cont)=76.8*((1-cos_alfa)/2+0.28/4-(0.28/4)*cos_alfa^2);
if (alfa<=180)
P(cont)=0.9;
elseif (alfa<=360)
P(cont)=320.612/((x(cont)+8.93023)^1.32);
elseif (alfa<=540)
P(cont)=1119.9/((x(cont)+8.93023)^1.24);
else
P(cont)=1.1;
end
V(cont)= 0.0448882+x(cont)*pi*(80^2)/4*(10^(-6));
end
figure(1)
plot(V,P,'-r'),title('Diagram P-V'),xlabel('Volume [l]'),ylabel('Pressure [bar]'),grid;
fprintf('\n')
fprintf('alfa\t\tx[mm]\t\tP[bar]\t\tV[l]\n')
fprintf('%-6.4f\t\t%-6.4f\t\t%-6.4f\t\t%-6.4f\n',[alfa_cont x P V]')
Accepted Answer
More Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!