How can I fix the alignment
Afficher commentaires plus anciens
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]')
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Genetic Algorithm dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!