Displaying in terms of pi
Afficher commentaires plus anciens
I have the written the following code but I'm not too sure how to display the x values in terms of pi. Is that possible?Also in my current code, it's only showing integer value and not to multiple decimal places despite using format long.
clear;
format long;
fprintf(' x sin(x)');
out = fopen('out.txt','w');% w is used to write data
for i = 0:(pi/11):pi
fprintf(out,'\n %5.0f %5.0f ',i,sin(i));
end;
fclose(out);
OUTPUT:
x sin(x)
0 0
0 0
1 1
1 1
1 1
1 1
2 1
2 1
2 1
3 1
3 0
3 0
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Files and Folders 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!